gert and git do not agree on what order to read the config
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 52/100
Research direction
Reproduce the configuration-ordering difference from /path/to/project using the shown .gitconfig and IncludeIf files, comparing command-line git with gert from R. Read gert's configuration handling and determine how duplicate keys and included files are ordered; done means both clients select the same Bizarro credentials regardless of the IncludeIf location.
Written by the indexing model from the issue text.
Description
It looks like {gert} prioritizes config items from top to bottom, but command line git prioritizes bottom to top in the case of duplicate keys.
I have a situation where I want to use a different set of credentials for a project. I found the IncludeIf directive for .gitconfig files from https://nicknisi.com/posts/git-includeif/ and I applied it like so:
[user]
name="Clark"
[email protected]
[credential]
helper=/path/to/helper
# ... gitconfig stuff ...
[includeIf "gitdir:/path/to/project"]
path = ~/.gitconfig-pat
and in my ~/.gitconfig-pat I have it set up to use the GitHub credentials for "Bizarro" in which I provision a temporary PAT inside of an environmental variable called BIZARRO_TOKEN a la https://git-scm.com/docs/gitfaq#http-credentials-environment
[user]
name="Bizarro"
[email protected]
[credential]
helper = '!f() {echo username=clark-is-not-bizarro && echo "password=${BIZARRO_TOKEN}"};f'
When I run git from /path/to/project in the command line, I can commit, push, and pull as "Bizarro", but if I open R and run {gert} from the same directory, I am recognized as "Clark".
If I move the IncludeIf statement to the top of the file, then {gert} will recognize "Bizarro", but git will recognise "Clark"
- Dominant language
- R
- Stars
- 162
- Forks
- 39
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from r-lib/gert
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Cite Alpine targetOpen
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
`git_add()` slowOpen
Difficulty 4/5 3-5 days Newbie friendliness 38/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
rstudio/reticulate#1933 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
lrberge/fixest#686 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100