FIX: Misbehaviour when on main due to star on branch name

This commit is contained in:
Jean-Claude 2022-03-13 15:08:45 +01:00
parent 80220479cc
commit 04daffe440
Signed by: jeanclaude
GPG Key ID: 8A300F57CBB9F63E
1 changed files with 8 additions and 2 deletions

10
Git.hs
View File

@ -32,12 +32,12 @@ runGit args = do
getBranches :: IO [Branch]
getBranches = do
out <- runGit ["--no-pager", "branch", "--list"]
return $ map H.trim $ lines out
return $ map gitTrim $ lines out
getCurrentBranch :: IO Branch
getCurrentBranch = do
out <- runGit ["branch", "--show-current"]
return $ H.trim out
return $ gitTrim out
branchExists :: Branch -> IO Bool
branchExists branch = do
@ -69,3 +69,9 @@ existUncommittedChanges = do
return False
else
return True
dropStar :: Branch -> Branch
dropStar = dropWhile (== '*')
gitTrim :: Branch -> Branch
gitTrim = H.trim . dropStar . H.trim