File: Some_calls_to_git_repeat_--config_values.mdwn

package info (click to toggle)
git-annex 10.20230126-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 69,344 kB
  • sloc: haskell: 74,654; javascript: 9,103; sh: 1,304; makefile: 203; perl: 136; ansic: 44
file content (69 lines) | stat: -rw-r--r-- 3,109 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
Some of git-annex's calls to git duplicate the `--config` values that
are passed by the caller.  Here's an example:

[[!format sh """
cd "$(mktemp -d --tmpdir gx-XXXXXXX)"
git init
git annex init -c foo.bar=true --debug
"""]]

```
[...]
[2020-03-11 10:59:12.932497354] call: git ["--git-dir=.git","--work-tree=.","--literal-pathspecs","-c","foo.bar=true","config","annex.uuid","ffad618f-a272-4d1b-8a5b-73778661ac1b"]
[2020-03-11 10:59:12.934971688] process done ExitSuccess
[2020-03-11 10:59:12.93926062] read: git ["config","--null","--list"]
[2020-03-11 10:59:12.941719766] process done ExitSuccess
[2020-03-11 10:59:12.942450637] read: git ["--git-dir=.git","--work-tree=.","--literal-pathspecs","-c","foo.bar=true","-c","foo.bar=true","show-ref","git-annex"]
[...]
[2020-03-11 10:59:12.955818683] read: git ["config","--null","--list"]
[2020-03-11 10:59:12.958211547] process done ExitSuccess
[2020-03-11 10:59:12.958313557] read: git ["--git-dir=.git","--work-tree=.","--literal-pathspecs","-c","foo.bar=true","-c","foo.bar=true","-c","foo.bar=true","status","--porcelain"]
[2020-03-11 10:59:12.960857733] process done ExitSuccess
[2020-03-11 10:59:12.960928142] call: git ["--git-dir=.git","--work-tree=.","--literal-pathspecs","-c","foo.bar=true","-c","foo.bar=true","-c","foo.bar=true","config","filter.annex.smudge","git-annex smudge -- %f"]
[2020-03-11 10:59:12.963408762] process done ExitSuccess
[...]
```

Based on looking at the full output, it seems like a repeated
`--config` value gets tacked on each time after the configuration is
re-read.

The above is with a git-annex built from 8.20200226-161-g1978a2420.  I
see the same duplicates with a git-annex built from
7.20190819-2-g908476a9b.

Those extra values shouldn't cause any problems, but this issue seems
worth filing in case there's a simple fix.

[[!meta author=kyle]]
[[!tag projects/datalad]]

> Fix was attempted in [[!commit c8fec6ab0]] but that
> caused [[annex-ssh-options_dropped_since_8.20200330]]
> so it was reverted.
> 
> The cause of the problem is that the action passed to adjustGitRepo
> gets run more than once in some cases where the Repo has changed
> and the adjustment needs to be re-done, so if it appends a value,
> the value may get appended to a Repo that already had it appended.
> 
> So that commit made it check if the value was present and not add it.
> I don't currently understand why, but that prevented the value getting
> added.
> --[[Joey]]

> > Huh, with that commit's patch, the option is passed to all calls to
> > git.. But not to the call to ssh.
> >
> > Ah.. remoteAnnexSshOptions is populated by parsing the git config,
> > and is what gets passed to ssh. The patch though made it not call
> > Git.Config.Store, so when the git config has been reloaded, it loses
> > the -c config.
> >
> > Also, I notice that c8fec6ab0 had a second bug: 
> > If -c foo=1 -c foo=2 -c foo=1 were passed, it would 
> > add the first and second, but not add the third.
> > 
> > I was really not at even 10% back in March. For obvious reasons.
> > 
> > Ok, all fixed, the right way this time. [[done]] --[[Joey]]