fix git-annex add regression on deleted file
Fix a regression in 10.20220624 that caused git-annex add to crash when there was an unstaged deletion. Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
parent
15c0cff2da
commit
94029995fa
5 changed files with 35 additions and 17 deletions
|
@ -23,6 +23,8 @@ git-annex (10.20220725) UNRELEASED; urgency=medium
|
|||
* Use curl when annex.security.allowed-url-schemes includes an url
|
||||
scheme not supported by git-annex internally, as long as
|
||||
annex.security.allowed-ip-addresses is configured to allow using curl.
|
||||
* Fix a regression in 10.20220624 that caused git-annex add to crash
|
||||
when there was an unstaged deletion.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Mon, 25 Jul 2022 15:35:45 -0400
|
||||
|
||||
|
|
|
@ -88,19 +88,17 @@ seek o = startConcurrency commandStages $ do
|
|||
addunlockedmatcher <- addUnlockedMatcher
|
||||
annexdotfiles <- getGitConfigVal annexDotFiles
|
||||
let gofile includingsmall (si, file) = case largeFilesOverride o of
|
||||
Nothing -> do
|
||||
s <- liftIO $ R.getSymbolicLinkStatus file
|
||||
ifM (pure (annexdotfiles || not (dotfile file))
|
||||
<&&> (checkFileMatcher largematcher file
|
||||
<||> Annex.getRead Annex.force))
|
||||
( start dr si file addunlockedmatcher
|
||||
, if includingsmall
|
||||
then ifM (annexAddSmallFiles <$> Annex.getGitConfig)
|
||||
( startSmall dr si file s
|
||||
, stop
|
||||
)
|
||||
else stop
|
||||
)
|
||||
Nothing -> ifM (pure (annexdotfiles || not (dotfile file))
|
||||
<&&> (checkFileMatcher largematcher file
|
||||
<||> Annex.getRead Annex.force))
|
||||
( start dr si file addunlockedmatcher
|
||||
, if includingsmall
|
||||
then ifM (annexAddSmallFiles <$> Annex.getGitConfig)
|
||||
( startSmall dr si file
|
||||
, stop
|
||||
)
|
||||
else stop
|
||||
)
|
||||
Just True -> start dr si file addunlockedmatcher
|
||||
Just False -> startSmallOverridden dr si file
|
||||
case batchOption o of
|
||||
|
@ -132,10 +130,13 @@ seek o = startConcurrency commandStages $ do
|
|||
dr = dryRunOption o
|
||||
|
||||
{- Pass file off to git-add. -}
|
||||
startSmall :: DryRun -> SeekInput -> RawFilePath -> FileStatus -> CommandStart
|
||||
startSmall dr si file s =
|
||||
starting "add" (ActionItemTreeFile file) si $
|
||||
addSmall dr file s
|
||||
startSmall :: DryRun -> SeekInput -> RawFilePath -> CommandStart
|
||||
startSmall dr si file =
|
||||
liftIO (catchMaybeIO $ R.getSymbolicLinkStatus file) >>= \case
|
||||
Just s ->
|
||||
starting "add" (ActionItemTreeFile file) si $
|
||||
addSmall dr file s
|
||||
Nothing -> stop
|
||||
|
||||
addSmall :: DryRun -> RawFilePath -> FileStatus -> CommandPerform
|
||||
addSmall dr file s = do
|
||||
|
|
2
Test.hs
2
Test.hs
|
@ -399,6 +399,8 @@ test_add_moved = intmpclonerepo $ do
|
|||
createDirectory subdir
|
||||
Utility.MoveFile.moveFile (toRawFilePath annexedfile) (toRawFilePath subfile)
|
||||
git_annex "add" [subdir] "add of moved annexed file"
|
||||
git "mv" [sha1annexedfile, sha1annexedfile ++ ".renamed"] "git mv"
|
||||
git_annex "add" [] "add does not fail on deleted file after move"
|
||||
where
|
||||
subdir = "subdir"
|
||||
subfile = subdir </> "file"
|
||||
|
|
|
@ -47,3 +47,5 @@ I am a little surprised that it is only datalad-crawler, not datalad or git-anne
|
|||
|
||||
[[!meta author=yoh]]
|
||||
[[!tag projects/datalad]]
|
||||
|
||||
> [[fixed|done]] --[[Joey]]
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
[[!comment format=mdwn
|
||||
username="joey"
|
||||
subject="""comment 2"""
|
||||
date="2022-08-19T16:39:11Z"
|
||||
content="""
|
||||
Fixed this.
|
||||
|
||||
The test suite does test add of renamed files, but just barely missed it
|
||||
since it ran git-annex add of the destination file only.
|
||||
Added a test case for this.
|
||||
"""]]
|
Loading…
Reference in a new issue