You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I discovered this in Windows Positron work. My Git for Windows installation has system-level config that sets init.defaultBranch to master. I have init.defaultBranch set to main at the user level. git_sitrep() shows this:
• Default initial branch name: "master" and "main"
which is weird!
The underlying issue is this:
dat<-gert::git_config_global()
subset(dat, name=="init.defaultbranch")
#> name value level#> 10 init.defaultbranch master system#> 13 init.defaultbranch main global
I think I've never personally experienced this before because here's the same information on macOS:
dat<-gert::git_config_global()
subset(dat, name=="init.defaultbranch")
#> name value level#> 7 init.defaultbranch main global
For the record, here are the Git versions in each location:
on macOS
git version 2.39.3 (Apple Git-145)
on Windows
git version 2.45.2.windows.1
so the Windows Git version is actually newer.
All that really matters is that usethis:::git_cfg_get() needs to account for this possibility, though:
Interesting tidbit from macOS. It's true that gert::git_config_global() doesn't reveal any system config, but there does seem to be some:
~/rrr/usethis % git config --show-origin --show-scope --list
unknown file:/Library/Developer/CommandLineTools/usr/share/git-core/gitconfig credential.helper=osxkeychain
unknown file:/Library/Developer/CommandLineTools/usr/share/git-core/gitconfig init.defaultbranch=main
global file:/Users/jenny/.gitconfig user.name=Jenny Bryan
global file:/Users/jenny/.gitconfig [email protected]
global file:/Users/jenny/.gitconfig user.signingkey=/Users/jenny/.ssh/id_ed25519.pub
... and so on and so forth ...
Notably this system config is labelled as "unknown", as opposed to "global" and "local" (or even "system").
Haven't tested this, but from the source it looks like git-for-windows lets the user choose the "system" value of init.defaultbranch during the installer process? So it is not specific to the version but rather to the vendor.
I think the unknown config file was hacked in by apple's git build to override some defaults in xcode. Note the path of this config is inside git-core so it really seems specific to this build of command-line-git and not intended for other git versions or libraries. That would explain why libgit2 does not find it, but I'll ask upstream in libgit2: libgit2/libgit2#6883
I discovered this in Windows Positron work. My Git for Windows installation has system-level config that sets
init.defaultBranch
tomaster
. I haveinit.defaultBranch
set tomain
at the user level.git_sitrep()
shows this:which is weird!
The underlying issue is this:
I think I've never personally experienced this before because here's the same information on macOS:
For the record, here are the Git versions in each location:
on macOS
on Windows
so the Windows Git version is actually newer.
All that really matters is that
usethis:::git_cfg_get()
needs to account for this possibility, though:usethis/R/utils-git.R
Lines 53 to 72 in 2cc9e5a
Currently it seems to basically gloss over system config and only accounts for global and local.
The text was updated successfully, but these errors were encountered: