diff options
Diffstat (limited to 'Command/Sync.hs')
-rw-r--r-- | Command/Sync.hs | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/Command/Sync.hs b/Command/Sync.hs index c41f46f8a..14c79e99d 100644 --- a/Command/Sync.hs +++ b/Command/Sync.hs @@ -103,19 +103,33 @@ syncRemotes rs = ifM (Annex.getState Annex.fast) ( nub <$> pickfast , wanted ) commit :: CommandStart commit = next $ next $ ifM isDirect ( do + showStart "commit" "" void stageDirect - runcommit [] - , runcommit [Param "-a"] - ) - where - runcommit ps = do + void preCommitDirect + commitStaged commitmessage + , do showStart "commit" "" - showOutput Annex.Branch.commit "update" -- Commit will fail when the tree is clean, so ignore failure. - let params = Param "commit" : ps ++ - [Param "-m", Param "git-annex automatic sync"] - _ <- inRepo $ tryIO . Git.Command.runQuiet params + _ <- inRepo $ tryIO . Git.Command.runQuiet + [ Param "commit" + , Param "-a" + , Param "-m" + , Param commitmessage + ] + return True + ) + where + commitmessage = "git-annex automatic sync" + +commitStaged :: String -> Annex Bool +commitStaged commitmessage = go =<< inRepo Git.Branch.currentUnsafe + where + go Nothing = return False + go (Just branch) = do + parent <- inRepo $ Git.Ref.sha branch + void $ inRepo $ Git.Branch.commit False commitmessage branch + (maybe [] (:[]) parent) return True mergeLocal :: Maybe Git.Ref -> CommandStart |