22b7852084bcfcbb3c2a67e66ff9461a34414860
[git-annex.git] /
1 [[!comment format=mdwn
2  username="joey"
3  subject="""comment 4"""
4  date="2019-12-27T18:41:12Z"
5  content="""
6 It's almost possible to get the same unwanted conversion without any git
7 races:
8
9         echo content-git > file-git
10         sleep 2
11         git add file-git
12         git commit -m add
13
14         echo foo > file-git
15         echo content-annex > file-annex
16         git -c annex.largefiles=anything annex add file-annex
17
18 In this case, git currently does not run the modified file-git through the
19 clean filter in the last line, so the annex.largefiles=anything doesn't
20 affect it.
21
22 But, as far as I can see, there's nothing preventing a future version
23 of git from deciding it does want to run file-git through the clean filter
24 in this case.
25
26 I am not going to try to prevent against such a thing happening.
27 As far as I can see, anything that the clean filter can possibly do to
28 avoid such a situation will cripple existing uses cases of
29 annex.largefiles, like largerthan() as mentioned above.
30 The user has told git-annex to annex "anything", and if git
31 decides to run the clean filter while that is in effect, caveat emptor.
32
33 Which is not to say I'm not going to fix the specific case this bug was
34 filed about. I actually have a fix developed now. But just to say that
35 setting annex.largefiles=anything/nothing temporarily is a blunt instrument,
36 and you risk accidental conversion when using it, and so it would be a good
37 idea to not do that.
38
39 One idea: Make `git-annex add --annex` and `git-annex add --git`
40 add a specific file to annex or git, bypassing annex.largefiles and all
41 other configuration and state. This could also be used to easily switch
42 a file from one storage to the other. I'd hope the existence of that
43 would prevent one-off setting of annex.largefiles=anything/nothing.
44 [[todo/git_annex_add_option_to_control_to_where]]
45 """]]