Skip to content

Commit 616fa87

Browse files
authored
Merge pull request #221 from mattpolzin/bugfix/220/less-stack-explosion
Fix stack explosion by doing less work on strings to the same effect
2 parents aa1325f + 6e09511 commit 616fa87

File tree

9 files changed

+30
-29
lines changed

9 files changed

+30
-29
lines changed

default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ let
3434
./man/harmony.1
3535
];
3636
};
37-
npmDepsHash = "sha256-4rWL3VrB/FgyUb/4WMhEwuqWUjn8m1Rs8jc+zyjcZAs=";
37+
npmDepsHash = "sha256-cyMbLrODGGDn5YVYiiCoou1yYqebIm1hZMAYujUmwI8=";
3838
dontNpmBuild = true;
3939
dontBuild = true;
4040

docs/_0_0_MANPAGE_HEADER.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
% harmony(1) Version 6.1.0 | Harmony User's Guide
1+
% harmony(1) Version 6.1.1 | Harmony User's Guide
22

flake.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

harmony.ipkg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package harmony
2-
version = 6.1.0
2+
version = 6.1.1
33
authors = "Mathew Polzin"
44
license = "MIT"
55
brief = "Harmony GitHub collaboration tool"
@@ -8,7 +8,7 @@ homepage = "https://github.com/mattpolzin/harmony"
88
sourceloc = "https://github.com/mattpolzin/harmony"
99
bugtracker = "https://github.com/mattpolzin/harmony/issues"
1010

11-
langversion >= 0.7.0
11+
langversion >= 0.8.0
1212

1313
depends = contrib
1414
, idris-adds >= 0.4.0

man/harmony.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" Automatically generated by Pandoc 3.7.0.2
22
.\"
3-
.TH "harmony" "1" "" "Version 6.1.0" "Harmony User\(cqs Guide"
3+
.TH "harmony" "1" "" "Version 6.1.1" "Harmony User\(cqs Guide"
44
.SH NAME
55
Harmony \- Harmonize with coworkers around GitHub reviewing
66
.SH SYNOPSIS

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mattpolzin/harmony",
3-
"version": "6.1.0",
3+
"version": "6.1.1",
44
"engines": {
55
"node": ">=18.0.0"
66
},

src/AppVersion.idr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module AppVersion
44

55
export
66
appVersion : String
7-
appVersion = "6.1.0"
7+
appVersion = "6.1.1"
88

99
export
1010
printVersion : HasIO io => io ()

src/System/Git.idr

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,12 @@ stdout = fst
2626
mapStdout : (String -> a) -> (String, String, Int) -> (a, String, Int)
2727
mapStdout = mapFst
2828

29-
||| Drop the given char from the String throughout and for any number of
30-
||| occurrences.
31-
dropChar : Char -> String -> String
32-
dropChar c = pack . go . unpack
33-
where
34-
go : List Char -> List Char
35-
go [] = []
36-
go (x :: xs) =
37-
let rest = go xs
38-
in if c == x then rest else (x :: rest)
29+
||| Drop the first char if it fits the predicate.
30+
dropFirstIf : (Char -> Bool) -> String -> String
31+
dropFirstIf pred str with (asList str)
32+
dropFirstIf pred "" | [] = ""
33+
dropFirstIf pred str@(strCons c str') | (c :: _) =
34+
if pred c then str' else str
3935

4036
promise : IO (a, String, Int) -> Promise' a
4137
promise gitOp = liftIO res >>= either
@@ -52,7 +48,12 @@ currentBranch : Promise' String
5248
currentBranch = map trim . promise $ git ["branch", "--show-current"]
5349

5450
parseBranchList : String -> List String
55-
parseBranchList = map trim . lines . dropChar '*'
51+
parseBranchList = map (trim . dropFirstIf specialPrefix) . lines
52+
where
53+
specialPrefix : Char -> Bool
54+
specialPrefix '*' = True
55+
specialPrefix '+' = True
56+
specialPrefix _ = False
5657

5758
export
5859
listBranches : Promise' (List String)

0 commit comments

Comments
 (0)