Direct mode: Fix support for adding a modified file.
Adding a file that is already annexed, but has been modified, was broken in direct mode. This fix makes the new content be added. It does have the problem that re-running `git annex add` will checksum and re-add the content repeatedly, until it's committed. This happens because the key associated with the file does not change until the new one gets committed, so it keeps thinking the file has changed.
This commit is contained in:
parent
2a4dad8bd4
commit
af1da07302
2 changed files with 8 additions and 3 deletions
|
@ -35,14 +35,14 @@ def = [notBareRepo $ command "add" paramPaths seek "add files to annex"]
|
||||||
seek :: [CommandSeek]
|
seek :: [CommandSeek]
|
||||||
seek =
|
seek =
|
||||||
[ withFilesNotInGit start
|
[ withFilesNotInGit start
|
||||||
, whenNotDirect $ withFilesUnlocked start
|
, withFilesUnlocked start
|
||||||
]
|
]
|
||||||
|
|
||||||
{- The add subcommand annexes a file, generating a key for it using a
|
{- The add subcommand annexes a file, generating a key for it using a
|
||||||
- backend, and then moving it into the annex directory and setting up
|
- backend, and then moving it into the annex directory and setting up
|
||||||
- the symlink pointing to its content. -}
|
- the symlink pointing to its content. -}
|
||||||
start :: FilePath -> CommandStart
|
start :: FilePath -> CommandStart
|
||||||
start file = ifAnnexed file fixup add
|
start file = ifAnnexed file addpresent add
|
||||||
where
|
where
|
||||||
add = do
|
add = do
|
||||||
s <- liftIO $ getSymbolicLinkStatus file
|
s <- liftIO $ getSymbolicLinkStatus file
|
||||||
|
@ -51,7 +51,11 @@ start file = ifAnnexed file fixup add
|
||||||
else do
|
else do
|
||||||
showStart "add" file
|
showStart "add" file
|
||||||
next $ perform file
|
next $ perform file
|
||||||
fixup (key, _) = do
|
addpresent (key, _) = ifM isDirect
|
||||||
|
( ifM (goodContent key file) ( stop , add )
|
||||||
|
, fixup key
|
||||||
|
)
|
||||||
|
fixup key = do
|
||||||
-- fixup from an interrupted add; the symlink
|
-- fixup from an interrupted add; the symlink
|
||||||
-- is present but not yet added to git
|
-- is present but not yet added to git
|
||||||
showStart "add" file
|
showStart "add" file
|
||||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -10,6 +10,7 @@ git-annex (3.20130217) UNRELEASED; urgency=low
|
||||||
* Android: Support ssh connection caching.
|
* Android: Support ssh connection caching.
|
||||||
* Direct mode: Support filesystems like FAT which can change their inodes
|
* Direct mode: Support filesystems like FAT which can change their inodes
|
||||||
each time they are mounted.
|
each time they are mounted.
|
||||||
|
* Direct mode: Fix support for adding a modified file.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Sun, 17 Feb 2013 16:42:16 -0400
|
-- Joey Hess <joeyh@debian.org> Sun, 17 Feb 2013 16:42:16 -0400
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue