f912f8e5fd
Always run Git.Config.store, so when the git config gets reloaded, the override gets re-added to it, and changeGitRepo then calls extractGitConfig on it and sees the annex.* settings from the override. Remove any prior occurance of -c v and add it to the end. This way, -c foo=1 -c foo=2 -c foo=1 will pass -c foo=1 to git, rather than -c foo=2 Note that, if git had some multiline config that got built up by multiple -c's, this would not work still. But it never worked because before the bug got fixed in the first place, the -c value was repeated many times, so the multivalue thing would have been wrong. I don't think -c can be used with multiline configs anyway, though git-config does talk about them?
50 lines
1.9 KiB
Markdown
50 lines
1.9 KiB
Markdown
When debugging some ssh-related datalad tests that hang with newer
|
|
git-annex versions, I noticed that there was a regression in the
|
|
treatment of annex-ssh-options in c8fec6ab0 (Fix a minor bug that
|
|
caused options provided with -c to be passed multiple times to git,
|
|
2020-03-16).
|
|
|
|
Here's a demo script. Pointing `SSHURL` to any ssh-accessible annex
|
|
repo should do. In the case below, the target is an annex repo with
|
|
one commit and no files in the working tree.
|
|
|
|
[[!format sh """
|
|
SSHURL="smaug:/home/kyle/scratch/repo"
|
|
|
|
cd "$(mktemp -d ${TMPDIR:-/tmp}/gx-ssh-opts-XXXXXXX)"
|
|
git clone "$SSHURL" ./ >/dev/null 2>&1
|
|
git annex init \
|
|
-c annex.sshcaching=false \
|
|
-c remote.origin.annex-ssh-options="-o ControlMaster=auto -S CACHE" \
|
|
--debug 2>&1 | grep 'read: ssh'
|
|
"""]]
|
|
|
|
With the parent of the above commit checked out (b166223d4), the
|
|
script outputs
|
|
|
|
```
|
|
[2020-06-30 11:09:43.853918422] read: ssh ["smaug","-o","ControlMaster=auto","-S","CACHE","-n","-T","git-annex-shell 'configlist' '/home/kyle/scratch/repo' '--debug'"]
|
|
```
|
|
|
|
With c8fec6ab0 checked out, it outputs
|
|
|
|
```
|
|
[2020-06-30 11:11:03.833678263] read: ssh ["smaug","-S",".git/annex/ssh/smaug","-o","ControlMaster=auto","-o","ControlPersist=yes","-n","-T","git-annex-shell 'configlist' '/home/kyle/scratch/repo' '--debug'"]
|
|
[2020-06-30 11:11:04.448046366] read: ssh ["-O","stop","-S","smaug","-o","ControlMaster=auto","-o","ControlPersist=yes","localhost"]
|
|
```
|
|
|
|
It looks like the options specified via
|
|
`remote.origin.annex-ssh-options` are dropped, and git-annex switches
|
|
to using its built-in ssh caching.
|
|
|
|
A recent commit on master (95b8b4a5a) shows the same behavior.
|
|
|
|
I've tried to work through the config-related handling and understand
|
|
why the condition from c8fec6ab0 results in the ssh options being
|
|
dropped, but I haven't made any progress yet.
|
|
|
|
[[!meta author=kyle]]
|
|
[[!tag projects/datalad]]
|
|
|
|
> [[fixed|done]] (also re-fixed the original bug in a better way)
|
|
> --[[Joey]]
|