Permalink
Browse files

move git status call from Haskell to zshrc

This allows to customize the call, in particular using the argument --untracked-files=no
  • Loading branch information...
olivierverdier committed Jan 14, 2016
1 parent 3ae03e9 commit 045d5a5deff183dbe131867b67f744b177e0997c
Showing with 2 additions and 6 deletions.
  1. +1 −5 src/app/Main.hs
  2. +1 −1 zshrc.sh
View
@@ -17,9 +17,6 @@ safeRun command arguments =
output <- readProcessWithExitCode command arguments ""
return (successOrNothing output)
gitstatus :: IO (Maybe String)
gitstatus = safeRun "git" ["status", "--porcelain", "--branch"]
gitrevparse :: IO (Maybe Hash)
gitrevparse = do -- IO
mresult <- safeRun "git" ["rev-parse", "--short", "HEAD"]
@@ -32,10 +29,9 @@ gitrevparse = do -- IO
main :: IO ()
main = do -- IO
mstatus <- gitstatus
status <- getContents
mhash <- unsafeInterleaveIO gitrevparse -- defer the execution until we know we need the hash
let result = do -- Maybe
status <- mstatus
strings <- stringsFromStatus mhash status
return (unwords strings)
putStr (fromMaybe "" result)
View
@@ -48,7 +48,7 @@ function update_current_git_vars() {
_GIT_STATUS=`python ${gitstatus} 2>/dev/null`
fi
if [[ "$GIT_PROMPT_EXECUTABLE" == "haskell" ]]; then
_GIT_STATUS=`$__GIT_PROMPT_DIR/src/.bin/gitstatus`
_GIT_STATUS=`git status --porcelain --branch &> /dev/null | $__GIT_PROMPT_DIR/src/.bin/gitstatus`
fi
__CURRENT_GIT_STATUS=("${(@s: :)_GIT_STATUS}")
GIT_BRANCH=$__CURRENT_GIT_STATUS[1]

0 comments on commit 045d5a5

Please sign in to comment.