unlock: Made atomic.
This commit is contained in:
parent
53706ad9bf
commit
9f9e17aa0f
3 changed files with 10 additions and 3 deletions
|
@ -44,11 +44,15 @@ perform dest key = do
|
||||||
|
|
||||||
g <- Annex.gitRepo
|
g <- Annex.gitRepo
|
||||||
let src = gitAnnexLocation g key
|
let src = gitAnnexLocation g key
|
||||||
liftIO $ removeFile dest
|
let tmpdest = gitAnnexTmpLocation g key
|
||||||
|
liftIO $ createDirectoryIfMissing True (parentDir tmpdest)
|
||||||
showNote "copying..."
|
showNote "copying..."
|
||||||
ok <- liftIO $ copyFile src dest
|
ok <- liftIO $ copyFile src tmpdest
|
||||||
if ok
|
if ok
|
||||||
then do
|
then do
|
||||||
liftIO $ allowWrite dest
|
liftIO $ do
|
||||||
|
removeFile dest
|
||||||
|
renameFile tmpdest dest
|
||||||
|
allowWrite dest
|
||||||
next $ return True
|
next $ return True
|
||||||
else error "copy failed!"
|
else error "copy failed!"
|
||||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -6,6 +6,7 @@ git-annex (0.20110611) UNRELEASED; urgency=low
|
||||||
such as btrfs.
|
such as btrfs.
|
||||||
* Allow --trust etc to specify a repository by name, for temporarily
|
* Allow --trust etc to specify a repository by name, for temporarily
|
||||||
trusting repositories that are not configured remotes.
|
trusting repositories that are not configured remotes.
|
||||||
|
* unlock: Made atomic.
|
||||||
* git-union-merge: New git subcommand, that does a generic union merge
|
* git-union-merge: New git subcommand, that does a generic union merge
|
||||||
operation, and operates efficiently without touching the working tree.
|
operation, and operates efficiently without touching the working tree.
|
||||||
|
|
||||||
|
|
|
@ -3,3 +3,5 @@ Running a command like
|
||||||
git annex unlock myfile
|
git annex unlock myfile
|
||||||
|
|
||||||
is not atomic, that is if the execution is aborted you may end up with an incomplete version of myfile in the directory. If you don't notice this you may lock it again and then propagate this bad version of the file to your other repositories. A simple workaround is to simply name it something else while unlocking and then rename it to the correct filename once it's completely copied. I don't know Haskel yet so I can not fix this issue otherwise I would sure try. A part from this, I love git annex.
|
is not atomic, that is if the execution is aborted you may end up with an incomplete version of myfile in the directory. If you don't notice this you may lock it again and then propagate this bad version of the file to your other repositories. A simple workaround is to simply name it something else while unlocking and then rename it to the correct filename once it's completely copied. I don't know Haskel yet so I can not fix this issue otherwise I would sure try. A part from this, I love git annex.
|
||||||
|
|
||||||
|
> [[fixed|done]] --[[Joey]]
|
||||||
|
|
Loading…
Reference in a new issue