better branch display
This commit is contained in:
parent
b1acf41036
commit
2035b22a01
1 changed files with 11 additions and 2 deletions
13
Branch.hs
13
Branch.hs
|
@ -10,7 +10,8 @@ module Branch (
|
||||||
update,
|
update,
|
||||||
get,
|
get,
|
||||||
change,
|
change,
|
||||||
commit
|
commit,
|
||||||
|
shortref
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Monad (unless, when, liftM)
|
import Control.Monad (unless, when, liftM)
|
||||||
|
@ -20,6 +21,7 @@ import System.Directory
|
||||||
import Data.String.Utils
|
import Data.String.Utils
|
||||||
import System.Cmd.Utils
|
import System.Cmd.Utils
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
import Data.List
|
||||||
|
|
||||||
import Types.BranchState
|
import Types.BranchState
|
||||||
import qualified GitRepo as Git
|
import qualified GitRepo as Git
|
||||||
|
@ -37,6 +39,13 @@ name = "git-annex"
|
||||||
fullname :: String
|
fullname :: String
|
||||||
fullname = "refs/heads/" ++ name
|
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. -}
|
{- A separate index file for the branch. -}
|
||||||
index :: Git.Repo -> FilePath
|
index :: Git.Repo -> FilePath
|
||||||
index g = Git.workTree g </> Git.gitDir g </> "index." ++ name
|
index g = Git.workTree g </> Git.gitDir g </> "index." ++ name
|
||||||
|
@ -151,7 +160,7 @@ updateRef ref
|
||||||
if (null diffs)
|
if (null diffs)
|
||||||
then return Nothing
|
then return Nothing
|
||||||
else do
|
else do
|
||||||
showSideAction $ "merging " ++ ref ++ " into " ++ name ++ "..."
|
showSideAction $ "merging " ++ shortref ref ++ " into " ++ name ++ "..."
|
||||||
-- By passing only one ref, it is actually
|
-- By passing only one ref, it is actually
|
||||||
-- merged into the index, preserving any
|
-- merged into the index, preserving any
|
||||||
-- changes that may already be staged.
|
-- changes that may already be staged.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue