summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-06-22 17:47:06 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-06-22 17:47:06 -0400
commit2035b22a01ba45505ce6367cdbeb1f6e86e9bd70 (patch)
treef93028d0e1f7bab843a2cd6b8589b0cc1d6a5d60
parentb1acf41036a1eddea29cc69c6b2a595582378465 (diff)
better branch display
-rw-r--r--Branch.hs13
1 files changed, 11 insertions, 2 deletions
diff --git a/Branch.hs b/Branch.hs
index ad9b805d0..e6896aa84 100644
--- a/Branch.hs
+++ b/Branch.hs
@@ -10,7 +10,8 @@ module Branch (
update,
get,
change,
- commit
+ commit,
+ shortref
) where
import Control.Monad (unless, when, liftM)
@@ -20,6 +21,7 @@ import System.Directory
import Data.String.Utils
import System.Cmd.Utils
import Data.Maybe
+import Data.List
import Types.BranchState
import qualified GitRepo as Git
@@ -37,6 +39,13 @@ name = "git-annex"
fullname :: String
fullname = "refs/heads/" ++ name
+shortref :: String -> String
+shortref = remove "refs/heads/" . remove "refs/remotes/"
+ where
+ remove prefix s
+ | prefix `isPrefixOf` s = drop (length prefix) s
+ | otherwise = s
+
{- A separate index file for the branch. -}
index :: Git.Repo -> FilePath
index g = Git.workTree g </> Git.gitDir g </> "index." ++ name
@@ -151,7 +160,7 @@ updateRef ref
if (null diffs)
then return Nothing
else do
- showSideAction $ "merging " ++ ref ++ " into " ++ name ++ "..."
+ showSideAction $ "merging " ++ shortref ref ++ " into " ++ name ++ "..."
-- By passing only one ref, it is actually
-- merged into the index, preserving any
-- changes that may already be staged.