push when git-annex branch changed
I was too heavy-handed in optimising away pushes
This commit is contained in:
parent
79872e360e
commit
a31b7d93c8
1 changed files with 9 additions and 6 deletions
|
@ -129,12 +129,16 @@ mergeRemote remote branch = all (== True) <$> mapM go [branch, syncBranch branch
|
||||||
remotebranch = Git.Ref.under $ "refs/remotes/" ++ Remote.name remote
|
remotebranch = Git.Ref.under $ "refs/remotes/" ++ Remote.name remote
|
||||||
|
|
||||||
pushRemote :: Remote.Remote Annex -> Git.Ref -> CommandStart
|
pushRemote :: Remote.Remote Annex -> Git.Ref -> CommandStart
|
||||||
pushRemote remote branch = go =<< newer
|
pushRemote remote branch = go =<< needpush
|
||||||
where
|
where
|
||||||
newer = do
|
needpush = (||)
|
||||||
e <- inRepo (Git.Ref.exists syncbranchRemote)
|
<$> newer syncbranch
|
||||||
|
<*> newer Annex.Branch.name
|
||||||
|
newer b = do
|
||||||
|
let r = remotebranch b
|
||||||
|
e <- inRepo (Git.Ref.exists r)
|
||||||
if e
|
if e
|
||||||
then inRepo $ Git.Branch.changed syncbranchRemote syncbranch
|
then inRepo $ Git.Branch.changed r b
|
||||||
else return True
|
else return True
|
||||||
go False = stop
|
go False = stop
|
||||||
go True = do
|
go True = do
|
||||||
|
@ -148,8 +152,7 @@ pushRemote remote branch = go =<< newer
|
||||||
]
|
]
|
||||||
refspec = show (Git.Ref.base branch) ++ ":" ++ show (Git.Ref.base syncbranch)
|
refspec = show (Git.Ref.base branch) ++ ":" ++ show (Git.Ref.base syncbranch)
|
||||||
syncbranch = syncBranch branch
|
syncbranch = syncBranch branch
|
||||||
syncbranchRemote = Git.Ref.under
|
remotebranch = Git.Ref.under $ "refs/remotes/" ++ Remote.name remote
|
||||||
("refs/remotes/" ++ Remote.name remote) syncbranch
|
|
||||||
|
|
||||||
currentBranch :: Annex Git.Ref
|
currentBranch :: Annex Git.Ref
|
||||||
currentBranch = Git.Ref . firstLine . L.unpack <$>
|
currentBranch = Git.Ref . firstLine . L.unpack <$>
|
||||||
|
|
Loading…
Reference in a new issue