a todo on: explicit metadata needed for view inclusion or not

This commit is contained in:
jkniiv 2023-02-15 19:07:25 +00:00 committed by admin
parent cb2f071377
commit 5565f6b61b

View file

@ -0,0 +1,115 @@
I'm not sure if this is a bug or a feature but the question is should files have (some/any)
explicit metadata set with `git-annex metadata` for them to be included in a view branch?
I mean if you create a view with just path-based fields (say, restrict to a subdirectory
with a criterion like 'subdir/=*'), do you expect files to match even if they don't have
any metadata fields manually set? In release version 10.20230214 the behavior has changed
in that files that don't have manual metadata set don't seem to be included in
(directory-based) view branches. The inverse seems to be true of the unreleased version
10.20230127-gc209e0f64 committed a week before.
In my opinion, this *could* be a feature if it's documented but it could also be construed
as violating the principle of least surprise as not all users routinely tag all annexed files
with metadata.
The following is a transcript that illustrates how the recent release version behaves. See
how the file `subdir/c` is excluded from the view branch (my apologies for this being a
PowerShell session on Windows):
[[!format sh """
X:\> cd git-annex-tests
X:\git-annex-tests> git init annex-view-test-a
X:\git-annex-tests> cd .\annex-view-test-a\
X:\git-annex-tests\annex-view-test-a [master]> git config annex.thin true
X:\git-annex-tests\annex-view-test-a [master]> git annex init Annex-view-test-a
X:\git-annex-tests\annex-view-test-a [adjusted/master(unlocked)]> echo Aaa > a
X:\git-annex-tests\annex-view-test-a [adjusted/master(unlocked) +1 ~0 -0 !]> mkdir subdir
X:\git-annex-tests\annex-view-test-a [adjusted/master(unlocked) +1 ~0 -0 !]> echo Bbb > subdir\b
X:\git-annex-tests\annex-view-test-a [adjusted/master(unlocked) +2 ~0 -0 !]> echo Ccc > subdir\c
X:\git-annex-tests\annex-view-test-a [adjusted/master(unlocked) +2 ~0 -0 !]> mkdir subdir\subsubdir
X:\git-annex-tests\annex-view-test-a [adjusted/master(unlocked) +2 ~0 -0 !]> echo Ddd > .\subdir\subsubdir\d
X:\git-annex-tests\annex-view-test-a [adjusted/master(unlocked) +2 ~0 -0 !]> git annex add .
add a
ok
add subdir/b
ok
add subdir/c
ok
add subdir/subsubdir/d
ok
(recording state in git...)
X:\git-annex-tests\annex-view-test-a [adjusted/master(unlocked) +4 ~0 -0 ~]> ls -r
Directory: X:\git-annex-tests\annex-view-test-a
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 15.2.2023 12:37 subdir
-a--- 15.2.2023 12:31 5 a
Directory: X:\git-annex-tests\annex-view-test-a\subdir
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 15.2.2023 12:38 subsubdir
-a--- 15.2.2023 12:34 5 b
-a--- 15.2.2023 12:37 5 c
Directory: X:\git-annex-tests\annex-view-test-a\subdir\subsubdir
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 15.2.2023 12:38 5 d
X:\git-annex-tests\annex-view-test-a [adjusted/master(unlocked) +4 ~0 -0 ~]> fsutil hardlink list a
\git-annex-tests\annex-view-test-a\.git\annex\objects\b29\a20\SHA256E-s5--e3c555b2205407e76d3a460513cf44c1c62e48ba83ec4948ed05d0f87b957051\SHA256E-s5--e3c555b2205407e76d3a460513cf44c1c62e48ba83ec4948ed05d0f87b957051
\git-annex-tests\annex-view-test-a\a
X:\git-annex-tests\annex-view-test-a [adjusted/master(unlocked) +4 ~0 -0 ~]> git commit -m 'Add test files'
[adjusted/master(unlocked) 56b11c9] Add test files
4 files changed, 4 insertions(+)
create mode 100644 a
create mode 100644 subdir/b
create mode 100644 subdir/c
create mode 100644 subdir/subsubdir/d
X:\git-annex-tests\annex-view-test-a [adjusted/master(unlocked)]> git annex metadata -t test subdir\b
metadata subdir/b
lastchanged=2023-02-15@10-52-31
tag=test
tag-lastchanged=2023-02-15@10-52-31
ok
(recording state in git...)
X:\git-annex-tests\annex-view-test-a [adjusted/master(unlocked)]> git annex metadata -t test subdir\subsubdir\d
metadata subdir/subsubdir/d
lastchanged=2023-02-15@10-53-00
tag=test
tag-lastchanged=2023-02-15@10-53-00
ok
(recording state in git...)
X:\git-annex-tests\annex-view-test-a [adjusted/master(unlocked)]> git annex metadata subdir\c
metadata subdir/c
ok
X:\git-annex-tests\annex-view-test-a [adjusted/master(unlocked)]> git annex view 'subdir\=*'
view (searching...)
Switched to branch 'views/adjusted/master(unlocked)(subdir_=_)'
ok
X:\git-annex-tests\annex-view-test-a [views/adjusted/master(unlocked)(subdir_=_)]> ls -r
Directory: X:\git-annex-tests\annex-view-test-a
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 15.2.2023 12:55 subsubdir
-a--- 15.2.2023 12:55 178 b_%subdir%
Directory: X:\git-annex-tests\annex-view-test-a\subsubdir
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 15.2.2023 12:55 181 d_%subdir%subsubdir%
# End of transcript or log.
"""]]
[[!meta author=jkniiv]]