3 subject="""comment 2"""
4 date="2020-05-28T16:24:35Z"
6 I think if there's a bug here, it's entirely about git-annex's behavior
7 when passed a non-annexed file, or a file that is not checked into git,
8 of silently skipping the file.
10 Users are fairly frequently surprised by that.
12 (See also [bugs/unlock_should_warn_if_file_isn__39__t_in_repo]] and
13 probably others that have been closed or handled in the forum.)
15 What git commit does is, if a file/directory exists but is not in git:
17 error: pathspec 'foo' did not match any file(s) known to git
19 On the other hand "git commit $dir" just ignores such files as it recurses
20 the directory tree (as long as something in the directory tree is known to
23 That would be fairly reasonable behavior for git-annex to have too.
24 But it would be a behavior change. If someone is used to
25 "git annex get foo*" getting all annexed files, but skipping the "foo~"
26 temp file that is not in git, then they would have to change scripts
29 Implementing it may be as simple as passing --error-unmatch to git
30 ls-files. (And disable git-annex's code that checks for parameters that are
33 It could be an option, but I don't really consider an option as fixing the
34 surprising behavior. And once you know git-annex behaves this way, I think
35 it's rarely surprising and so the benefit of having an option may not
36 justify having an option. I'd rather remove surprising behavior, if
37 possible, than add an option to paper over it.
39 I think this would need a transition plan. Eg:
41 * Add a git config option, defaulting to false, that can be set to true
43 * Document in NEWS that the config option will start defaulting to true in
44 some release (in say, 2022), so proactive users either set it to false
45 explicitly if they want to keep the current behavior, or can change their
47 * Ideally, display a warning in cases where the behavior is going to
48 change. But that would need some way to emulate --error-unmatch and
49 warn when it would error. And I think that would be hard to do and/or
51 * After the 2022 release the option would need to remain, or there
52 could be a later transition to remove it, by first having git-annex
53 warn about it being deprecated when it's set to true.
57 Also, it would need to be decided what to do about files that are checked
58 into git but are not annexed files. It seems to make sense for git-annex
59 get and drop of "foo*" to ignore "foo.txt" that is not annexed. But what about
60 git-annex metadata on the same file? Could be argued that is throwing away
61 the provided metadata, so should error, the same as if the file was not
62 checked into git at all. I don't like the behavior varying between
63 subcommands, so if metadata should error, so should get and drop.
65 There's code that currently skips those files and could error. It would
66 need to remember the input list of files, and check if the non-annexed
67 file was explicitly listed.
69 Oh, but what about the case where the non-annexed file is in a directory
70 and the directory is explicitly listed and contains no other annexed files?
71 Seems it ought to error for consistency there, but not if the directory
72 does contain another file that is annexed, in addition to the one that is
73 not. Implementing an error there seems to need a hash containing all the
74 passed filenames, and then files can be deleted from it as it finds annexed
75 files they expanded to, and at the end it can error out about any others.
76 Kind of ugly and the hash lookups for each file would slow things down
79 I think that users are less frequently bitten by git-annex ignoring
80 non-annexed files though.