lock: Reset unlocked file to index, rather than to branch head.

Resetting an unlocked file to the branch head failed if it had just been
added, not committed, and unlocked, since the branch didbn't have it.

The code was concerned about dropping any changes that might be staged in the
index, but I cannot see why.
This commit is contained in:
Joey Hess 2012-05-30 17:01:22 -04:00
parent 96f00bafd0
commit 65977a5584
3 changed files with 6 additions and 7 deletions

View file

@ -24,9 +24,5 @@ start file = do
perform :: FilePath -> CommandPerform
perform file = do
liftIO $ removeFile file
-- 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.
Annex.Queue.add "checkout" [Param "HEAD", Param "--"] [file]
Annex.Queue.add "checkout" [Param "--"] [file]
next $ return True -- no cleanup needed

1
debian/changelog vendored
View file

@ -1,6 +1,7 @@
git-annex (3.20120523) UNRELEASED; urgency=low
* sync: Show a nicer message if a user tries to sync to a special remote.
* lock: Reset unlocked file to index, rather than to branch head.
-- Joey Hess <joeyh@debian.org> Sun, 27 May 2012 20:55:29 -0400

View file

@ -1,5 +1,7 @@
Add a file, then unlock it, and then lock it. There is an error and the
symlink gets deleted.
Add a file (do not commit), then unlock it, and then lock it.
There is an error and the symlink gets deleted.
The file will still be staged in the index, and the file content is still
in the annex. --[[Joey]]
[[done]]