Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

refactor internal function git_cfg_get() #1718

Closed
ijlyttle opened this issue Jan 5, 2023 · 0 comments · Fixed by #1719
Closed

refactor internal function git_cfg_get() #1718

ijlyttle opened this issue Jan 5, 2023 · 0 comments · Fixed by #1719

Comments

@ijlyttle
Copy link
Contributor

ijlyttle commented Jan 5, 2023

This emerged from #1714:

I have two emails set up in my git config: my work email is global email, but I (try to) use my personal email as local for open-source projects.

When I run git_sitrep(), with both global and local emails set:

Warning message:
In grepl(de_facto_email, addresses) :
  argument 'pattern' has length > 1 and only the first element will be used

I traced this to a call to git_cfg_get("user.email", "de_facto"), which returns both emails, e.g.:

git_cfg_get("user.email", "global")
#> "ian.lyttle@<work>.com"

git_cfg_get("user.email", "local")
#> "ijlyttle@me.com"  

git_cfg_get("user.email", "de_facto")
#> "ian.lyttle@<work>.com" "ijlyttle@me.com"  

@jennybc confirms git_cfg_get("foo", "de_facto") should return a single value, where the local value trumps the global value.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant