Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Respect core.abbrev when abbreviating SHAs #124

Open
maninak opened this issue Apr 29, 2024 · 1 comment
Open

Respect core.abbrev when abbreviating SHAs #124

maninak opened this issue Apr 29, 2024 · 1 comment
Labels
enhancement New feature extending the app's current capabilities

Comments

@maninak
Copy link
Collaborator

maninak commented Apr 29, 2024

We should respect core.abbrev when abbreviating git SHAs and keep defaulting to 7 chars if it isn't defined. This would improve support for non-small projects.

Theoretically, all we have to do is read the related git config and use it inside shortenHash().

Note, we should also respect special non-numeric values where core.abbrev can
be legally set to "auto" or "no", where "auto" gets an appropriate
length based on a loose count of objects in the current repo, and
"no" which doesn't abbreviate the SHA1 at all.

@maninak maninak converted this from a draft issue Apr 29, 2024
@maninak maninak added the enhancement New feature extending the app's current capabilities label Apr 29, 2024
@maninak maninak moved this from 🆕 Backlog to 📋 Up Next in Radicle VS Code Extension Apr 29, 2024
@lorenzleutgeb
Copy link
Contributor

lorenzleutgeb commented Apr 30, 2024

Proof of concept (you can execute this locally and verify that it prints the same as git rev-parse --short HEAD | tr -d '\n' | wc -c): https://gist.github.com/lorenzleutgeb/62a19762e5e7546ecfcdae2fb9b7d82d

Note in particular that the default for core.abbrev is not 7, but "auto"!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature extending the app's current capabilities
Projects
Status: 📋 Up Next
Development

No branches or pull requests

3 participants