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.
This commit is contained in:
Joey Hess 2016-02-29 15:23:08 -04:00
parent 9e1ebc2336
commit 7c20bf6e7a
Failed to extract signature
8 changed files with 81 additions and 61 deletions

View file

@ -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,