bug/question on the semantic of find --unlocked

This commit is contained in:
yarikoptic 2022-02-18 19:17:37 +00:00 committed by admin
parent faf84aa5c2
commit 4643788916

View file

@ -0,0 +1,63 @@
`git annex find --unlocked` reports also not just files which are known to `git-annex` as unlocked, but also files which were regular "locked" (symlinks) but are modified in the tree:
<details>
<summary>here is a reproducer script</summary>
```shell
#!/bin/bash
cd "$(mktemp -d ${TMPDIR:-/tmp}/dl-XXXXXXX)"
set -eu
git init
git annex init
echo 123 > 123
git annex add 123
git commit -m 'commit 123 locked'
git annex unlock 123
git commit -m 'commit 123 unlocked' 123
set -x
git annex find --unlocked # should show 123
git status # should show all clean
# let's create another file which we just modify
echo 124 > 124
git annex add 124
git commit -m 'committing 124 locked' 124
rm 124
touch 124
git annex find --unlocked # will report both 123 and 124
git status
```
</details>
which with git-annex `8.20211231+git140-gc3817495f-1~ndall+1` would produce at the end
```
+ git commit -m 'committing 124 locked' 124
[master b58274c] committing 124 locked
1 file changed, 1 insertion(+)
create mode 120000 124
+ rm 124
+ touch 124
+ git annex find --unlocked
123
124
+ git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
typechange: 124
no changes added to commit (use "git add" and/or "git commit -a")
```
and I do not think it should report `124` as unlocked. Or is there some `find` way to search only for "truly unlocked" files?