assistant: Fix a crash when a small file is deleted immediately after being created
git add will fail if the file got deleted in the meantime. And since it was queued, there was a window until the queue flushed where a deletion of the file would cause a crash. Instead, reuse Command.Add.addFile, which sha1 hashes the file itself immediately, and then queues the index update. Ignore exceptions that will happen if the file got deleted already. Sponsored-by: k0ld on Patreon
This commit is contained in:
parent
553962eb47
commit
217a6abb19
3 changed files with 10 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
{- git-annex assistant commit thread
|
{- git-annex assistant commit thread
|
||||||
-
|
-
|
||||||
- Copyright 2012-2021 Joey Hess <id@joeyh.name>
|
- Copyright 2012-2023 Joey Hess <id@joeyh.name>
|
||||||
-
|
-
|
||||||
- Licensed under the GNU AGPL version 3 or higher.
|
- Licensed under the GNU AGPL version 3 or higher.
|
||||||
-}
|
-}
|
||||||
|
@ -38,6 +38,7 @@ import qualified Annex
|
||||||
import Utility.InodeCache
|
import Utility.InodeCache
|
||||||
import qualified Database.Keys
|
import qualified Database.Keys
|
||||||
import qualified Command.Sync
|
import qualified Command.Sync
|
||||||
|
import qualified Command.Add
|
||||||
import Config.GitConfig
|
import Config.GitConfig
|
||||||
import Utility.Tuple
|
import Utility.Tuple
|
||||||
import Utility.Metered
|
import Utility.Metered
|
||||||
|
@ -303,8 +304,10 @@ handleAdds lockdowndir havelsof largefilematcher annexdotfiles delayadd cs = ret
|
||||||
f = toRawFilePath (changeFile change)
|
f = toRawFilePath (changeFile change)
|
||||||
|
|
||||||
addsmall [] = noop
|
addsmall [] = noop
|
||||||
addsmall toadd = liftAnnex $ Annex.Queue.addCommand [] "add"
|
addsmall toadd = liftAnnex $ void $ tryIO $
|
||||||
[ Param "--force", Param "--"] (map changeFile toadd)
|
forM (map (toRawFilePath . changeFile) toadd) $ \f ->
|
||||||
|
Command.Add.addFile Command.Add.Small f
|
||||||
|
=<< liftIO (R.getSymbolicLinkStatus f)
|
||||||
|
|
||||||
{- Avoid overhead of re-injesting a renamed unlocked file, by
|
{- Avoid overhead of re-injesting a renamed unlocked file, by
|
||||||
- examining the other Changes to see if a removed file has the
|
- examining the other Changes to see if a removed file has the
|
||||||
|
|
|
@ -91,6 +91,8 @@ git-annex (10.20230408) UNRELEASED; urgency=medium
|
||||||
* config: Added the --show-origin and --for-file options.
|
* config: Added the --show-origin and --for-file options.
|
||||||
* config: Support annex.numcopies and annex.mincopies.
|
* config: Support annex.numcopies and annex.mincopies.
|
||||||
* Fix display when run with -J1.
|
* Fix display when run with -J1.
|
||||||
|
* assistant: Fix a crash when a small file is deleted immediately after
|
||||||
|
being created.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Sat, 08 Apr 2023 13:57:18 -0400
|
-- Joey Hess <id@joeyh.name> Sat, 08 Apr 2023 13:57:18 -0400
|
||||||
|
|
||||||
|
|
|
@ -67,3 +67,5 @@ Committer crashed: user error (xargs ["-0","git","--git-dir=.git","--work-tree=.
|
||||||
|
|
||||||
# End of transcript or log.
|
# End of transcript or log.
|
||||||
"""]]
|
"""]]
|
||||||
|
|
||||||
|
> [[fixed|done]] --[[Joey]]
|
||||||
|
|
Loading…
Reference in a new issue