Skip to content

Commit

Permalink
main is the new master branch
Browse files Browse the repository at this point in the history
  • Loading branch information
gerdreiss committed Nov 1, 2020
1 parent 0df82be commit 14f68be
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,3 @@ With `stack exec -- gitallup-exe --help` to see this text:
updating, comma separated
-v,--verbose Verbose output?
~~~~
## Run tests
`stack test`
2 changes: 2 additions & 0 deletions hie.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cradle:
stack:
13 changes: 11 additions & 2 deletions src/Git.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ where

import qualified Data.ByteString.Lazy as B
import qualified Data.ByteString.Lazy.Char8 as C8
import RIO

import RIO ( ExitCode
( ExitFailure
, ExitSuccess
)
, RIO
)
import RIO.Process ( proc
, readProcess
)
Expand Down Expand Up @@ -42,9 +48,12 @@ gitResetHard branch =
>>= _processResult

isMasterBranch :: B.ByteString -> Bool
isMasterBranch s = "* master" `elem` branches
isMasterBranch s = any (`elem` _masterBranches) branches
where branches = lines . C8.unpack $ s

_processResult :: ReadProcessResult -> RIO App ()
_processResult (ExitSuccess , out, _ ) = logSuc (C8.unpack out)
_processResult (ExitFailure code, _ , err) = logErr code (C8.unpack err)

_masterBranches :: [String]
_masterBranches = ["* master", "* main"]

0 comments on commit 14f68be

Please sign in to comment.