unannex: Clean up use of git commit -a.

This was more complex than would be expected. unannex has to use git commit -a
since it's removing files from git; git commit filelist won't do.

Allow commands to be added to the Git queue that have no associated files,
and run such commands once.
This commit is contained in:
Joey Hess 2011-07-14 16:56:06 -04:00
parent 0c46cbab09
commit ded2591124
10 changed files with 26 additions and 20 deletions

View file

@ -87,6 +87,6 @@ cleanup file key = do
force <- Annex.getState Annex.force
if force
then AnnexQueue.add "add" [Param "-f", Param "--"] file
else AnnexQueue.add "add" [Param "--"] file
then AnnexQueue.add "add" [Param "-f", Param "--"] [file]
else AnnexQueue.add "add" [Param "--"] [file]
return True

View file

@ -44,5 +44,5 @@ perform file link = do
cleanup :: FilePath -> CommandCleanup
cleanup file = do
AnnexQueue.add "add" [Param "--"] file
AnnexQueue.add "add" [Param "--"] [file]
return True

View file

@ -45,5 +45,5 @@ perform file = do
cleanup :: FilePath -> CommandCleanup
cleanup file = do
AnnexQueue.add "add" [Param "--"] file
AnnexQueue.add "add" [Param "--"] [file]
return True

View file

@ -33,5 +33,5 @@ perform file = do
-- Checkout from HEAD to get rid of any changes that might be
-- staged in the index, and get back to the previous symlink to
-- the content.
AnnexQueue.add "checkout" [Param "HEAD", Param "--"] file
AnnexQueue.add "checkout" [Param "HEAD", Param "--"] [file]
next $ return True -- no cleanup needed

View file

@ -78,6 +78,6 @@ cleanup file key = do
-- Commit staged changes at end to avoid confusing the
-- pre-commit hook if this file is later added back to
-- git as a normal, non-annexed file.
AnnexQueue.add "commit" [Params "-a -m", Param "content removed from git annex"] "-a"
AnnexQueue.add "commit" [Params "-a -m", Param "content removed from git annex"] []
return True