migrate: Don't fall over a stale temp file.
This commit is contained in:
parent
8b892901a9
commit
c70b78d40a
3 changed files with 7 additions and 3 deletions
|
@ -48,9 +48,10 @@ perform file oldkey newbackend = do
|
||||||
src <- fromRepo $ gitAnnexLocation oldkey
|
src <- fromRepo $ gitAnnexLocation oldkey
|
||||||
tmp <- fromRepo gitAnnexTmpDir
|
tmp <- fromRepo gitAnnexTmpDir
|
||||||
let tmpfile = tmp </> takeFileName file
|
let tmpfile = tmp </> takeFileName file
|
||||||
|
cleantmp tmpfile
|
||||||
liftIO $ createLink src tmpfile
|
liftIO $ createLink src tmpfile
|
||||||
k <- Backend.genKey tmpfile $ Just newbackend
|
k <- Backend.genKey tmpfile $ Just newbackend
|
||||||
liftIO $ cleantmp tmpfile
|
cleantmp tmpfile
|
||||||
case k of
|
case k of
|
||||||
Nothing -> stop
|
Nothing -> stop
|
||||||
Just (newkey, _) -> do
|
Just (newkey, _) -> do
|
||||||
|
@ -70,7 +71,7 @@ perform file oldkey newbackend = do
|
||||||
next $ Command.Add.cleanup file newkey True
|
next $ Command.Add.cleanup file newkey True
|
||||||
else stop
|
else stop
|
||||||
where
|
where
|
||||||
cleantmp t = whenM (doesFileExist t) $ removeFile t
|
cleantmp t = liftIO $ whenM (doesFileExist t) $ removeFile t
|
||||||
link src newkey = getViaTmpUnchecked newkey $ \t -> do
|
link src newkey = getViaTmpUnchecked newkey $ \t -> do
|
||||||
-- Make a hard link to the old backend's
|
-- Make a hard link to the old backend's
|
||||||
-- cached key, to avoid wasting disk space.
|
-- cached key, to avoid wasting disk space.
|
||||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -16,6 +16,7 @@ git-annex (3.20111112) UNRELEASED; urgency=low
|
||||||
* Fix support for insteadOf url remapping. Closes: #644278
|
* Fix support for insteadOf url remapping. Closes: #644278
|
||||||
* When not run in a git repository, git-annex can still display a usage
|
* When not run in a git repository, git-annex can still display a usage
|
||||||
message, and "git annex version" even works.
|
message, and "git annex version" even works.
|
||||||
|
* migrate: Don't fall over a stale temp file.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Sat, 12 Nov 2011 14:50:21 -0400
|
-- Joey Hess <joeyh@debian.org> Sat, 12 Nov 2011 14:50:21 -0400
|
||||||
|
|
||||||
|
|
|
@ -47,4 +47,6 @@ The error:
|
||||||
failed
|
failed
|
||||||
git-annex: migrate: 1 failed
|
git-annex: migrate: 1 failed
|
||||||
|
|
||||||
|
> Fixed it to delete the stale temp file. [[done]]
|
||||||
|
>
|
||||||
|
> Thanks for making such clear test cases, Jim! --[[Joey]]
|
||||||
|
|
Loading…
Reference in a new issue