'annex add' locks unmodified file in V5 but not V6

This commit is contained in:
kyle 2018-08-30 19:07:03 +00:00 committed by admin
parent 2969d93283
commit 5567496518

View file

@ -0,0 +1,40 @@
### Please describe the problem.
In a V6 repo, if I unlock a file, modify it, and `git annex add` it,
it ends up in a locked state:
echo foo >foo && git annex add foo && git commit -mfoo
git annex unlock foo && echo more >>foo && git annex add foo
git cat-file -p :foo
# .git/annex/objects/60/QW/SHA256E-s9--323409d9a706bc08d0b2c7f71309e21a757367c81cffb405a88e61749d79952d/SHA256E-s9--323409d9a706bc08d0b2c7f71309e21a757367c81cffb405a88e61749d79952d
However, if I do the same, minus the modification, the file stays
unlocked:
git reset --hard
git annex unlock foo && git annex add foo
git cat-file -p :foo
# /annex/objects/SHA256E-s4--b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c
I'd expect the second action to end up with a locked file because (1)
it does with a modified file and (2) it does in V5.
From a user's perspective, I suppose this is a minor inconsistency,
and it's easy enough to call `git annex lock` here instead `git annex
add`. But in the case of DataLad, it makes the handling of our
internal `git annex add` calls trickier because we assume the V5
"annex add unconditionally locks" behavior and we'd have to add
special handling for the V6 behavior.
### What version of git-annex are you using? On what operating system?
git-annex version: 6.20180808-gdad627fa9
build flags: Assistant Webapp Pairing S3(multipartupload)(storageclasses) WebDAV Inotify ConcurrentOutput TorrentParser Feeds Testsuite
dependency versions: aws-0.17.1 bloomfilter-2.0.1.0 cryptonite-0.23 DAV-1.3.1 feed-0.3.12.0 ghc-8.0.2 http-client-0.5.7.0 persistent-sqlite-2.6.2 torrent-10000.1.1 uuid-1.3.13 yesod-1.4.5
key/value backends: SHA256E SHA256 SHA512E SHA512 SHA224E SHA224 SHA384E SHA384 SHA3_256E SHA3_256 SHA3_512E SHA3_512 SHA3_224E SHA3_224 SHA3_384E SHA3_384 SKEIN256E SKEIN256 SKEIN512E SKEIN512 BLAKE2B256E BLAKE2B256 BLAKE2B512E BLAKE2B512 BLAKE2B160E BLAKE2B160 BLAKE2B224E BLAKE2B224 BLAKE2B384E BLAKE2B384 BLAKE2S256E BLAKE2S256 BLAKE2S160E BLAKE2S160 BLAKE2S224E BLAKE2S224 BLAKE2SP256E BLAKE2SP256 BLAKE2SP224E BLAKE2SP224 SHA1E SHA1 MD5E MD5 WORM URL
remote types: git gcrypt p2p S3 bup directory rsync web bittorrent webdav adb tahoe glacier ddar hook external
operating system: linux x86_64
supported repository versions: 3 5 6
upgrade supported from repository versions: 0 1 2 3 4 5
on Debian Stretch, built from source with `stack build`