]> dgit.raspbian.org Git - git-annex.git/blob
9f1c014ce53ebc7f178fc3e5cb150fbee918e475
[git-annex.git] /
1 ### Please describe the problem.
2
3 From our inspection,  `annex metadata` call relies on `ls-files` to determine if the file is known to annex.  But if there is an `addurl --batch` running which is adding those files, `git` is not immediately aware of them, thus `git annex metadata` returns "peacefully" without actually performing any operation on metadata.
4
5 ### What steps will reproduce the problem?
6
7 this is an extract from what we are doing in datalad, so might be insufficient (let us know if so)
8
9 1. run `git annex addurl --batch` and add a file
10 2. run `git annex metadata` to assign some metadata to the just addurl'ed file
11
12
13 ### What version of git-annex are you using? On what operating system?
14
15
16 6.20180316+gitg308f3ecf6-1~ndall+1
17
18 ### Please provide any additional information below.
19
20 [[!format sh """
21 $> git -c receive.autogc=0 -c gc.auto=0 annex --debug metadata --json -s verbal_iq+=116 -s performance_iq+=89 -s age+=16.77 -s handedness+=ambidextrous -s site_id+=pitt -s session_count+=1 -s dsm_iv_tr+=autism -s sex+=Male -s project+=abide_initiative -s full_iq+=103 -s MRI+=yes -s diagnosis+=autism -s participant_id+=50002 -s session_id+=1 -s species+=homo-sapiens -- sub-50002/ses-1/T1_rep-0.mgz                                                                             [2018-03-27 11:25:15.953624157] read: git ["--git-dir=.git","--work-tree=.","--literal-pathspecs","ls-files","--cached","-z","--","sub-50002/ses-1/T1_rep-0.mgz"]
22 [2018-03-27 11:25:15.957761277] process done ExitSuccess
23
24 # no error exit code
25 $> px | grep addurl.*batch
26 yoh      26767  0.0  0.0  17892  2184 pts/16   T    11:05   0:00  |       \_ /usr/lib/git-annex.linux/exe/git --library-path /usr/lib/git-annex.linux//usr/lib/x86_64-linux-gnu/gconv:/usr/lib/git-annex.linux//usr/lib/x86_64-linux-gnu/audit:/usr/lib/git-annex.linux//etc/ld.so.conf.d:/usr/lib/git-annex.linux//lib64:/usr/lib/git-annex.linux//usr/lib/x86_64-linux-gnu:/usr/lib/git-annex.linux//lib/x86_64-linux-gnu: /usr/lib/git-annex.linux/shimmed/git/git -c receive.autogc=0 -c gc.auto=0 annex addurl --with-files --json --batch
27 yoh      26790  0.0  0.3 1074180296 63604 pts/16 Tl 11:05   0:00  |           \_ /usr/lib/git-annex.linux/exe/git-annex --library-path /usr/lib/git-annex.linux//usr/lib/x86_64-linux-gnu/gconv:/usr/lib/git-annex.linux//usr/lib/x86_64-linux-gnu/audit:/usr/lib/git-annex.linux//etc/ld.so.conf.d:/usr/lib/git-annex.linux//lib64:/usr/lib/git-annex.linux//usr/lib/x86_64-linux-gnu:/usr/lib/git-annex.linux//lib/x86_64-linux-gnu: /usr/lib/git-annex.linux/shimmed/git-annex/git-annex addurl --with-files --json --batch
28
29 """]]
30
31
32 P.S.  It might be a related observation that git-annex metadata does exit with non-0 exit code whenever it is ran on a non-existing file, but it exits with 0 exit code (but without performing any action) when ran on the existing but not known to git file.  I wondered if there could be if not a change in behavior but a flag to make `annex metadata PATHs` exit with non-0 code if it didn't handle some path(s) from the provided.  Then we could use it within our "set metadata" to guarantee that we do not omit any file for which we thought we would get metadata operation performed.
33
34 [[!meta author=yoh]]
35 [[!tag projects/datalad]]
36
37 [[!meta title="silently skipping files that are not in git or not annexed is sometimes surprising to some"]]
38
39 > annex.skipunknown false will make git-annex error out in this situation.
40 > That will become the default in a couple of years, but can be set already
41 > by those who don't like the behavior of skipping. 
42 > 
43 > In the case of addurl --batch though, do see my first comment for a way to
44 > avoid any errors.
45 > 
46 > [[done]] --[[Joey]]