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

Feature request: make git_sitrep() more digestible #1714

Closed
ijlyttle opened this issue Dec 26, 2022 · 3 comments · Fixed by #1717
Closed

Feature request: make git_sitrep() more digestible #1714

ijlyttle opened this issue Dec 26, 2022 · 3 comments · Fixed by #1717

Comments

@ijlyttle
Copy link
Contributor

ijlyttle commented Dec 26, 2022

I find git_sitrep() to be an immensely useful function. However, it does provide a lot of information at once.

When you're just getting set up, it might be nice to get the status of just one part at a time. I think it could be interesting to provide some filtering options, e.g.:

git_sitrep("global", "git")
── Global git config 
• Name: 'Ian Lyttle'
• Email: 'ijlyttle@me.com'
• Global (user-level) gitignore file: '~/.gitignore'
• Vaccinated: TRUE
• Default Git protocol: 'https'
• Default initial branch name: 'main'

Would you consider a PR where:

  • the function could look something like:

    git_sitrep <- function(scope = c("global", "project"), tool = c("git", "github")) {
      scope <- rlang::arg_match(scope, multiple = TRUE)
      tool <- rlang::arg_match(tool, multiple = TRUE)
      # rest of the owl
    }
  • the output could use cli::cli_h3() headers?

@jennybc
Copy link
Member

jennybc commented Jan 3, 2023

Sure, sounds promising.

@ijlyttle
Copy link
Contributor Author

ijlyttle commented Jan 3, 2023

I have hit a snag, on the intention of "de_facto".

Incidentally, 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"  

Questions

  • should git_cfg_get("foo", "de_facto") return a single value, where the local value trumps the global value?
  • if so, would you like me to include this in this issue, or as a different issue?

Thanks!

@jennybc
Copy link
Member

jennybc commented Jan 5, 2023

should git_cfg_get("foo", "de_facto") return a single value, where the local value trumps the global value?

Yeah, I think so. I haven't touched this code in a long time, but, looking at it now, it sure looks wrong.

I think that should be a separate PR and we should handle it first, then come back to this. I would also check if anything has changed favourably in the gert world since I wrote this. It doesn't feel great to be trying to emulate what git does here. I.e. I wish we had a way to pass the desire for the de facto setting to libgit2 and let it sort this out. But we might just have to keep doing this ourselves.

# 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.

2 participants