change v6 git-annex add of staged unmodified unlocked file
v6: When a file is unlocked but has not been modified, and the unlocking is only staged, git-annex add did not lock it. Now it will, for consistency with how modified files are handled and with v5. Note the removal of the sameInodeCache check. Otherwise it would see that the unmodified file is unmodified and stop there. That check seems to have been copied from the direct mode branch. But, direct mode had a specific reason to check for unmodified content, that does not apply to v6. The second pass means there is potential for a race, eg the unlocked file could be modified in between the first and second passes. No problem with that, since both passes do the same thing. This commit was sponsored by Jake Vosloo on Patreon.
This commit is contained in:
parent
5e0c7bf81d
commit
2743224658
5 changed files with 49 additions and 8 deletions
|
@ -69,8 +69,11 @@ seek o = allowConcurrentOutput $ do
|
|||
unless (updateOnly o) $
|
||||
go (withFilesNotInGit (not $ includeDotFiles o))
|
||||
go withFilesMaybeModified
|
||||
unlessM (versionSupportsUnlockedPointers <||> isDirect) $
|
||||
go withFilesOldUnlocked
|
||||
ifM versionSupportsUnlockedPointers
|
||||
( go withUnlockedPointersToBeCommitted
|
||||
, unlessM isDirect $
|
||||
go withFilesOldUnlocked
|
||||
)
|
||||
|
||||
{- Pass file off to git-add. -}
|
||||
startSmall :: FilePath -> CommandStart
|
||||
|
@ -111,8 +114,7 @@ start file = do
|
|||
addpresent key = ifM versionSupportsUnlockedPointers
|
||||
( liftIO (catchMaybeIO $ getSymbolicLinkStatus file) >>= \case
|
||||
Just s | isSymbolicLink s -> fixuplink key
|
||||
_ -> ifM (sameInodeCache file =<< Database.Keys.getInodeCaches key)
|
||||
( stop, add )
|
||||
_ -> add
|
||||
, ifM isDirect
|
||||
( liftIO (catchMaybeIO $ getSymbolicLinkStatus file) >>= \case
|
||||
Just s | isSymbolicLink s -> fixuplink key
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue