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

how to get the short hash of a commit ? #273

Open
kforner opened this issue Mar 23, 2017 · 5 comments
Open

how to get the short hash of a commit ? #273

kforner opened this issue Mar 23, 2017 · 5 comments

Comments

@kforner
Copy link

kforner commented Mar 23, 2017

I did not manage to figure out how to get the short hash of a commit.
I can get it manually via: git rev-parse --short my_commit.
Is there a way using git2r ?

Thanks

@stewid
Copy link
Member

stewid commented Mar 23, 2017

Sorry, that feature is not supported in git2r.

@kforner
Copy link
Author

kforner commented Mar 23, 2017

not yet, or is there a reason not to ? I mean would you accept a PR for instance ?
Thanks.

@stewid
Copy link
Member

stewid commented Mar 23, 2017

A PR would be much appreciated 👍
Maybe a good starting point is https://libgit2.github.com/libgit2/#HEAD/type/git_oid_shorten
Thanks

@kforner
Copy link
Author

kforner commented Mar 27, 2017

ok. What I'm not sure to understand, is do I need to add all current OIDs in the repository tree in the git_oid_shorten instance ?
Otherwise I can't see how it could need to increase the length.

@cimbusch
Copy link

@kforner did you find a solution how to extract the short hash?

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

No branches or pull requests

3 participants