diff options
author | Joey Hess <joey@kitenet.net> | 2013-07-03 15:42:56 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-07-03 15:42:56 -0400 |
commit | ac3d31034a0a2181e21d3ad599450322ed6a55dd (patch) | |
tree | 7135de5cab66606444ab0ea2504e9ef53fbc651f /Command/Merge.hs | |
parent | fa45610f3809b7c0f1a469547d0c7e4209c05a9d (diff) |
merge: Now also merges synced/master or similar branches, which makes it useful to put in a post-receive hook to make a repository automatically update its working copy when git annex sync or the assistant sync with it.
Diffstat (limited to 'Command/Merge.hs')
-rw-r--r-- | Command/Merge.hs | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/Command/Merge.hs b/Command/Merge.hs index 382a251df..659f14080 100644 --- a/Command/Merge.hs +++ b/Command/Merge.hs @@ -1,6 +1,6 @@ {- git-annex command - - - Copyright 2011 Joey Hess <joey@kitenet.net> + - Copyright 2011, 2013 Joey Hess <joey@kitenet.net> - - Licensed under the GNU GPL version 3 or higher. -} @@ -10,22 +10,29 @@ module Command.Merge where import Common.Annex import Command import qualified Annex.Branch +import qualified Git.Branch +import Command.Sync (mergeLocal) def :: [Command] def = [command "merge" paramNothing seek SectionMaintenance - "auto-merge remote changes into git-annex branch"] + "automatically merge changes from remotes"] seek :: [CommandSeek] -seek = [withNothing start] +seek = + [ withNothing mergeBranch + , withNothing mergeSynced + ] -start :: CommandStart -start = do - showStart "merge" "." - next perform +mergeBranch :: CommandStart +mergeBranch = do + showStart "merge" "git-annex" + next $ do + Annex.Branch.update + -- commit explicitly, in case no remote branches were merged + Annex.Branch.commit "update" + next $ return True -perform :: CommandPerform -perform = do - Annex.Branch.update - -- commit explicitly, in case no remote branches were merged - Annex.Branch.commit "update" - next $ return True +mergeSynced :: CommandStart +mergeSynced = do + branch <- inRepo Git.Branch.current + maybe stop mergeLocal branch |