avoid duplicate add action for v6 unlocked modified file
The new second pass sees the file as type changed because the first pass's changes have typically not reached git yet. So, have to explicitly check for unmodified files in the second pass. Note that, if the file has been touched but not really modified, the first pass will handle it, and so the second pass does nothing. This commit was sponsored by Jochen Bartl on Patreon.
This commit is contained in:
parent
8b21761a42
commit
50217f62a1
2 changed files with 13 additions and 7 deletions
|
@ -31,6 +31,8 @@ import Remote.List
|
|||
import qualified Remote
|
||||
import Annex.CatFile
|
||||
import Annex.Content
|
||||
import Annex.InodeSentinal
|
||||
import qualified Database.Keys
|
||||
|
||||
withFilesInGit :: (FilePath -> CommandStart) -> [WorkTreeItem] -> CommandSeek
|
||||
withFilesInGit a l = seekActions $ prepFiltered a $
|
||||
|
@ -146,15 +148,19 @@ isOldUnlocked f = liftIO (notSymlink f) <&&>
|
|||
withFilesOldUnlockedToBeCommitted :: (FilePath -> CommandStart) -> [WorkTreeItem] -> CommandSeek
|
||||
withFilesOldUnlockedToBeCommitted = withFilesOldUnlocked' LsFiles.typeChangedStaged
|
||||
|
||||
{- v6 unlocked pointer files that are staged to be committed -}
|
||||
withUnlockedPointersToBeCommitted :: (FilePath -> CommandStart) -> [WorkTreeItem] -> CommandSeek
|
||||
withUnlockedPointersToBeCommitted a l = seekActions $
|
||||
{- v6 unlocked pointer files that are staged, and whose content has not been
|
||||
- modified-}
|
||||
withUnmodifiedUnlockedPointers :: (FilePath -> CommandStart) -> [WorkTreeItem] -> CommandSeek
|
||||
withUnmodifiedUnlockedPointers a l = seekActions $
|
||||
prepFiltered a unlockedfiles
|
||||
where
|
||||
unlockedfiles = filterM isV6Unlocked =<< seekHelper LsFiles.typeChangedStaged l
|
||||
unlockedfiles = filterM isV6UnmodifiedUnlocked
|
||||
=<< seekHelper LsFiles.typeChangedStaged l
|
||||
|
||||
isV6Unlocked :: FilePath -> Annex Bool
|
||||
isV6Unlocked f = (isJust <$> catKeyFile f <||> isJust <$> catKeyFileHEAD f)
|
||||
isV6UnmodifiedUnlocked :: FilePath -> Annex Bool
|
||||
isV6UnmodifiedUnlocked f = catKeyFile f >>= \case
|
||||
Nothing -> return False
|
||||
Just k -> sameInodeCache f =<< Database.Keys.getInodeCaches k
|
||||
|
||||
{- Finds files that may be modified. -}
|
||||
withFilesMaybeModified :: (FilePath -> CommandStart) -> [WorkTreeItem] -> CommandSeek
|
||||
|
|
|
@ -70,7 +70,7 @@ seek o = allowConcurrentOutput $ do
|
|||
go (withFilesNotInGit (not $ includeDotFiles o))
|
||||
go withFilesMaybeModified
|
||||
ifM versionSupportsUnlockedPointers
|
||||
( go withUnlockedPointersToBeCommitted
|
||||
( go withUnmodifiedUnlockedPointers
|
||||
, unlessM isDirect $
|
||||
go withFilesOldUnlocked
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue