Skip to content

Commit

Permalink
Show git branch in workspace pane
Browse files Browse the repository at this point in the history
Fixes #342

Uses the new safe localBranches function to show a default text if
you are not in a Git project.
  • Loading branch information
NWuensche committed Sep 3, 2016
1 parent 2173f0c commit 73ae12b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions cabal.project
Expand Up @@ -6,6 +6,7 @@ packages:
vendor/ltk/
vendor/haskellVCSGUI/vcsgui/
vendor/yi/
vendor/haskellVCSWrapper/vcswrapper/

package gi-atk
flags: -overloaded-methods -overloaded-signals -overloaded-properties
Expand Down
6 changes: 4 additions & 2 deletions src/IDE/Pane/Workspace.hs
Expand Up @@ -193,8 +193,10 @@ toMarkup record pkg = do
let dir = ipdPackageDir pkg
let conf = Git.makeConfig (Just dir) Nothing Nothing
liftIO $ Git.runVcs conf $ do
(branch,_) <- localBranches -- TODO What if there is no branch?
return branch
branch <- Git.localBranchesSafe
case branch of
(Right (branch,_)) -> return branch
(Left _) -> return "No Git project"
where
bold str = "<b>" <> str <> "</b>"
italic str = "<i>" <> str <> "</i>"
Expand Down

0 comments on commit 73ae12b

Please sign in to comment.