Merge branch 'master' into git-remote-annex

This commit is contained in:
Joey Hess 2024-05-15 17:49:12 -04:00
commit 468de43d66
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 66 additions and 27 deletions

View file

@ -26,7 +26,6 @@ import Types.Backend
import Types.KeySource
import Utility.Hash
import Utility.Metered
import qualified Utility.RawFilePath as R
import qualified Data.ByteString as S
import qualified Data.ByteString.Short as S (toShort, fromShort)
@ -129,14 +128,9 @@ keyValueE hash source meterupdate =
checkKeyChecksum :: (Key -> String -> Bool) -> Hash -> Key -> RawFilePath -> Annex Bool
checkKeyChecksum issame hash key file = catchIOErrorType HardwareFault hwfault $ do
fast <- Annex.getRead Annex.fast
exists <- liftIO $ R.doesPathExist file
case (exists, fast) of
(True, False) -> do
showAction (UnquotedString descChecksum)
issame key
<$> hashFile hash file nullMeterUpdate
_ -> return True
showAction (UnquotedString descChecksum)
issame key
<$> hashFile hash file nullMeterUpdate
where
hwfault e = do
warning $ UnquotedString $ "hardware fault: " ++ show e

View file

@ -3,6 +3,10 @@ git-annex (10.20240431) UNRELEASED; urgency=medium
* git-remote-annex: New program which allows pushing a git repo to a
git-annex special remote, and cloning from a special remote.
(Based on Michael Hanke's git-remote-datalad-annex.)
* fsck: Fix recent reversion that made it say it was checksumming files
whose content is not present.
* Avoid the --fast option preventing checksumming in some cases it
was not supposed to.
* Typo fixes.
Thanks, Yaroslav Halchenko

View file

@ -504,16 +504,19 @@ checkKeyUpgrade _ _ _ (AssociatedFile Nothing) =
checkBackend :: Key -> KeyStatus -> AssociatedFile -> Annex Bool
checkBackend key keystatus afile = do
content <- calcRepo (gitAnnexLocation key)
ifM (pure (isKeyUnlockedThin keystatus) <&&> (not <$> isUnmodified key content))
( nocheck
, do
mic <- withTSDelta (liftIO . genInodeCache content)
ifM (checkBackendOr badContent key content ai)
( do
checkInodeCache key content mic ai
return True
, return False
)
ifM (liftIO $ R.doesPathExist content)
( ifM (pure (isKeyUnlockedThin keystatus) <&&> (not <$> isUnmodified key content))
( nocheck
, do
mic <- withTSDelta (liftIO . genInodeCache content)
ifM (checkBackendOr badContent key content ai)
( do
checkInodeCache key content mic ai
return True
, return False
)
)
, nocheck
)
where
nocheck = return True
@ -525,14 +528,18 @@ checkBackendRemote key remote ai localcopy =
checkBackendOr (badContentRemote remote localcopy) key localcopy ai
checkBackendOr :: (Key -> Annex String) -> Key -> RawFilePath -> ActionItem -> Annex Bool
checkBackendOr bad key file ai = do
ok <- verifyKeyContent' key file
unless ok $ do
msg <- bad key
warning $ actionItemDesc ai
<> ": Bad file content; "
<> UnquotedString msg
return ok
checkBackendOr bad key file ai =
ifM (Annex.getRead Annex.fast)
( return True
, do
ok <- verifyKeyContent' key file
unless ok $ do
msg <- bad key
warning $ actionItemDesc ai
<> ": Bad file content; "
<> UnquotedString msg
return ok
)
{- Check, if there are InodeCaches recorded for a key, that one of them
- matches the object file. There are situations where the InodeCache

View file

@ -0,0 +1,34 @@
It seems that performing `git annex adjust --unlock-present` or `sync`
will remove the +x permission from files.
Steps to reproduce:
$ mkdir /tmp/ga; cd /tmp/ga; git init ; git annex init
$ touch a.txt s.sh
$ chmod +x s.sh
$ git annex add . && git annex sync
$ stat -Lc%A s.sh
-r-xr-xr-x
$ git annex adjust --unlock-present
$ stat -c%A s.sh
-rw-r--r--
The permission is removed also after a sync, but only in case other
files have been changed (and adjust called behind the scenes):
$ chmod +x s.sh
$ git annex sync
$ stat -c%A s.sh
-rwxr-xr-x
$ git annex drop --force a.txt
$ stat -c%A s.sh
-rwxr-xr-x
$ git annex sync
$ stat -c%A s.sh
-rw-r--r--
I'm using git-annex version: 10.20240430-g5b36e6b4 with
annex.alwayscommit = false.
PS: git-annex is so solid that this is the first data-related issue I've
ever seen. Kudos!