From 6318e53fb1dc8e60952427170cf0c16b86c20276 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 31 Mar 2016 14:56:10 -0400 Subject: made some progress on syncing adjusted branches, but still buggy --- Command/Sync.hs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'Command') diff --git a/Command/Sync.hs b/Command/Sync.hs index 4753a8fdc..42484e3ba 100644 --- a/Command/Sync.hs +++ b/Command/Sync.hs @@ -1,7 +1,7 @@ {- git-annex command - - Copyright 2011 Joachim Breitner - - Copyright 2011-2014 Joey Hess + - Copyright 2011-2016 Joey Hess - - Licensed under the GNU GPL version 3 or higher. -} @@ -243,21 +243,28 @@ commitStaged commitmode commitmessage = do return True mergeLocal :: CurrBranch -> CommandStart -mergeLocal currbranch@(Just branch, _) = go =<< needmerge +mergeLocal currbranch@(Just branch, madj) = do + proptoorig + go =<< needmerge where syncbranch = syncBranch branch needmerge = ifM isBareRepo ( return False , ifM (inRepo $ Git.Ref.exists syncbranch) - ( inRepo $ Git.Branch.changed branch syncbranch + ( inRepo $ Git.Branch.changed branch' syncbranch , return False ) ) go False = stop go True = do showStart "merge" $ Git.Ref.describe syncbranch - next $ next $ - merge currbranch Git.Branch.ManualCommit syncbranch + next $ next $ merge currbranch Git.Branch.ManualCommit syncbranch + branch' = maybe branch (originalToAdjusted branch) madj + -- When in an adjusted branch, propigate any changes made to it + -- back to the original branch. + proptoorig = case madj of + Just adj -> propigateAdjustedCommits branch (adj, branch') + Nothing -> return () mergeLocal (Nothing, _) = stop pushLocal :: CurrBranch -> CommandStart @@ -267,13 +274,7 @@ pushLocal b = do updateSyncBranch :: CurrBranch -> Annex () updateSyncBranch (Nothing, _) = noop -updateSyncBranch (Just branch, madj) = do - -- When in an adjusted branch, propigate any changes to it back to - -- the original branch. - case madj of - Just adj -> propigateAdjustedCommits branch - (adj, originalToAdjusted branch adj) - Nothing -> return () +updateSyncBranch (Just branch, _) = do -- Update the sync branch to match the new state of the branch inRepo $ updateBranch (syncBranch branch) branch -- In direct mode, we're operating on some special direct mode -- cgit v1.2.3