avoid writing same symlink twice in a row
authorJoey Hess <joeyh@joeyh.name>
Tue, 14 Jun 2022 18:30:12 +0000 (14:30 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 14 Jun 2022 18:30:12 +0000 (14:30 -0400)
Oddly, the second write did not cause it to lose the mtime inherited
from the file being added, although the mtime was not provided to that
write but only to the first. I don't quite know why that worked before!

Annex/Ingest.hs

index 90b2d6dbef8ee5d66ef26d4bb7442514d6c4d813..da9d4b5ae492beb9b927c9d9c71e6f4e785e57ad 100644 (file)
@@ -341,8 +341,8 @@ addLink ci file key mcache = ifM (coreSymlinks <$> Annex.getGitConfig)
 
 addSymlink :: RawFilePath -> Key -> Maybe InodeCache -> Annex ()
 addSymlink file key mcache = do
-       l <- makeLink file key mcache
-       addAnnexLink l file
+       linktarget <- makeLink file key mcache
+       stageSymlink file =<< hashSymlink linktarget
 
 {- Parameters to pass to git add, forcing addition of ignored files.
  -