aboutsummaryrefslogtreecommitdiff
path: root/Git/Ref.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-02-29 15:23:08 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-02-29 15:23:08 -0400
commit0fbaf6062e95885daf0da056c2a77d9e20154d41 (patch)
tree1d1d1b85bc5960e383a9705b9a25b65c8a99b48b /Git/Ref.hs
parent03e0498964647559f5eeece6750c8a2999860ae0 (diff)
make sync aware of adjusted branches
So, it will pull and push the original branch, not the adjusted one. And, for merging, it will use updateAdjustedBranch (not implemented yet). Note that remaining uses of Git.Branch.current need to be checked too; for things that should act on the original branch, and not the adjusted branch.
Diffstat (limited to 'Git/Ref.hs')
-rw-r--r--Git/Ref.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/Git/Ref.hs b/Git/Ref.hs
index 6bc47d5ed..7f21b0ab8 100644
--- a/Git/Ref.hs
+++ b/Git/Ref.hs
@@ -31,11 +31,14 @@ base = Ref . remove "refs/heads/" . remove "refs/remotes/" . fromRef
| prefix `isPrefixOf` s = drop (length prefix) s
| otherwise = s
+{- Gets the basename of any qualified ref. -}
+basename :: Ref -> Ref
+basename = Ref . reverse . takeWhile (/= '/') . reverse . fromRef
+
{- Given a directory and any ref, takes the basename of the ref and puts
- it under the directory. -}
under :: String -> Ref -> Ref
-under dir r = Ref $ dir ++ "/" ++
- (reverse $ takeWhile (/= '/') $ reverse $ fromRef r)
+under dir r = Ref $ dir ++ "/" ++ fromRef (basename r)
{- Given a directory such as "refs/remotes/origin", and a ref such as
- refs/heads/master, yields a version of that ref under the directory,