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
|
* Use curl when annex.security.allowed-url-schemes includes an url
|
||||||
scheme not supported by git-annex internally, as long as
|
scheme not supported by git-annex internally, as long as
|
||||||
annex.security.allowed-ip-addresses is configured to allow using curl.
|
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
|
-- Joey Hess <id@joeyh.name> Mon, 25 Jul 2022 15:35:45 -0400
|
||||||
|
|
||||||
|
|
|
@ -88,19 +88,17 @@ seek o = startConcurrency commandStages $ do
|
||||||
addunlockedmatcher <- addUnlockedMatcher
|
addunlockedmatcher <- addUnlockedMatcher
|
||||||
annexdotfiles <- getGitConfigVal annexDotFiles
|
annexdotfiles <- getGitConfigVal annexDotFiles
|
||||||
let gofile includingsmall (si, file) = case largeFilesOverride o of
|
let gofile includingsmall (si, file) = case largeFilesOverride o of
|
||||||
Nothing -> do
|
Nothing -> ifM (pure (annexdotfiles || not (dotfile file))
|
||||||
s <- liftIO $ R.getSymbolicLinkStatus file
|
<&&> (checkFileMatcher largematcher file
|
||||||
ifM (pure (annexdotfiles || not (dotfile file))
|
<||> Annex.getRead Annex.force))
|
||||||
<&&> (checkFileMatcher largematcher file
|
( start dr si file addunlockedmatcher
|
||||||
<||> Annex.getRead Annex.force))
|
, if includingsmall
|
||||||
( start dr si file addunlockedmatcher
|
then ifM (annexAddSmallFiles <$> Annex.getGitConfig)
|
||||||
, if includingsmall
|
( startSmall dr si file
|
||||||
then ifM (annexAddSmallFiles <$> Annex.getGitConfig)
|
, stop
|
||||||
( startSmall dr si file s
|
)
|
||||||
, stop
|
else stop
|
||||||
)
|
)
|
||||||
else stop
|
|
||||||
)
|
|
||||||
Just True -> start dr si file addunlockedmatcher
|
Just True -> start dr si file addunlockedmatcher
|
||||||
Just False -> startSmallOverridden dr si file
|
Just False -> startSmallOverridden dr si file
|
||||||
case batchOption o of
|
case batchOption o of
|
||||||
|
@ -132,10 +130,13 @@ seek o = startConcurrency commandStages $ do
|
||||||
dr = dryRunOption o
|
dr = dryRunOption o
|
||||||
|
|
||||||
{- Pass file off to git-add. -}
|
{- Pass file off to git-add. -}
|
||||||
startSmall :: DryRun -> SeekInput -> RawFilePath -> FileStatus -> CommandStart
|
startSmall :: DryRun -> SeekInput -> RawFilePath -> CommandStart
|
||||||
startSmall dr si file s =
|
startSmall dr si file =
|
||||||
starting "add" (ActionItemTreeFile file) si $
|
liftIO (catchMaybeIO $ R.getSymbolicLinkStatus file) >>= \case
|
||||||
addSmall dr file s
|
Just s ->
|
||||||
|
starting "add" (ActionItemTreeFile file) si $
|
||||||
|
addSmall dr file s
|
||||||
|
Nothing -> stop
|
||||||
|
|
||||||
addSmall :: DryRun -> RawFilePath -> FileStatus -> CommandPerform
|
addSmall :: DryRun -> RawFilePath -> FileStatus -> CommandPerform
|
||||||
addSmall dr file s = do
|
addSmall dr file s = do
|
||||||
|
|
2
Test.hs
2
Test.hs
|
@ -399,6 +399,8 @@ test_add_moved = intmpclonerepo $ do
|
||||||
createDirectory subdir
|
createDirectory subdir
|
||||||
Utility.MoveFile.moveFile (toRawFilePath annexedfile) (toRawFilePath subfile)
|
Utility.MoveFile.moveFile (toRawFilePath annexedfile) (toRawFilePath subfile)
|
||||||
git_annex "add" [subdir] "add of moved annexed file"
|
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
|
where
|
||||||
subdir = "subdir"
|
subdir = "subdir"
|
||||||
subfile = subdir </> "file"
|
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]]
|
[[!meta author=yoh]]
|
||||||
[[!tag projects/datalad]]
|
[[!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…
Add table
Reference in a new issue