diff --git a/Assistant/Threads/Committer.hs b/Assistant/Threads/Committer.hs index 5a3a88b47d..79eed77e95 100644 --- a/Assistant/Threads/Committer.hs +++ b/Assistant/Threads/Committer.hs @@ -40,6 +40,7 @@ import qualified Database.Keys import qualified Command.Sync import qualified Command.Add import Config.GitConfig +import qualified Git.Branch import Utility.Tuple import Utility.Metered import qualified Utility.RawFilePath as R @@ -240,7 +241,11 @@ commitStaged msg = do Left _ -> return False Right _ -> do cmode <- annexCommitMode <$> Annex.getGitConfig - ok <- Command.Sync.commitStaged cmode msg + ok <- inRepo $ Git.Branch.commitCommand cmode + (Git.Branch.CommitQuiet True) + [ Param "-m" + , Param msg + ] when ok $ Command.Sync.updateBranches =<< getCurrentBranch return ok diff --git a/Command/Sync.hs b/Command/Sync.hs index 52fe4c4aa0..e222dd0874 100644 --- a/Command/Sync.hs +++ b/Command/Sync.hs @@ -19,7 +19,6 @@ module Command.Sync ( prepMerge, mergeLocal, mergeRemote, - commitStaged, commitMsg, pushBranch, updateBranch, @@ -429,14 +428,6 @@ commitMsg = do m <- uuidDescMap return $ "git-annex in " ++ maybe "unknown" fromUUIDDesc (M.lookup u m) -commitStaged :: Git.Branch.CommitMode -> String -> Annex Bool -commitStaged commitmode commitmessage = - inRepo $ Git.Branch.commitCommand commitmode - (Git.Branch.CommitQuiet True) - [ Param "-m" - , Param commitmessage - ] - mergeLocal :: [Git.Merge.MergeConfig] -> SyncOptions -> CurrBranch -> CommandStart mergeLocal mergeconfig o currbranch = stopUnless (notOnlyAnnex o) $ mergeLocal' mergeconfig o currbranch diff --git a/Command/Undo.hs b/Command/Undo.hs index ceb70d279b..000cc1c313 100644 --- a/Command/Undo.hs +++ b/Command/Undo.hs @@ -1,6 +1,6 @@ {- git-annex command - - - Copyright 2014 Joey Hess + - Copyright 2014-2024 Joey Hess - - Licensed under the GNU AGPL version 3 or higher. -} @@ -18,7 +18,6 @@ import qualified Annex import qualified Git.LsFiles as LsFiles import qualified Git.Command as Git import qualified Git.Branch -import qualified Command.Sync import qualified Utility.RawFilePath as R cmd :: Command @@ -42,7 +41,7 @@ seek ps = do -- Committing staged changes before undo allows later -- undoing the undo. It would be nicer to only commit staged -- changes to the specified files, rather than all staged changes. - void $ Command.Sync.commitStaged Git.Branch.ManualCommit + void $ commitStaged Git.Branch.ManualCommit "commit before undo" withStrings (commandAction . start) ps @@ -81,3 +80,11 @@ perform p = do inRepo $ Git.run [Param "checkout", Param "--", File f] next $ liftIO cleanup + +commitStaged :: Git.Branch.CommitMode -> String -> Annex Bool +commitStaged commitmode commitmessage = + inRepo $ Git.Branch.commitCommand commitmode + (Git.Branch.CommitQuiet True) + [ Param "-m" + , Param commitmessage + ]