Divergent hash length behaviour from git when running `git describe --tags --always`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.1k
- Forks
- 450
- Avg merge
- 11m
- Merged PRs (30d)
- 1
Description
Hey there!
Noticed that when using git2 to compute the result of git describe, the behaviour can diverge from git
In particular this code
pub fn git_describe_native(path: &Path) -> Result<String> {
let repo = Repository::open(path)?;
let mut describe_opts = DescribeOptions::new();
describe_opts.describe_tags();
describe_opts.show_commit_oid_as_fallback(true);
let description = repo.describe(&describe_opts).into_diagnostic()?;
let format_opts = DescribeFormatOptions::new();
description.format(Some(&format_opts)).into_diagnostic()?;
}
will differ from git describe --tags --always in specific cases where the repo grows too large.
According to git docs the length of the abbreviation scales as the repository grows, using the approximate number of objects in the repository and a bit of math around the birthday paradox, and defaults to a minimum of 7.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the git_describe_native entry point shown in the issue and compare its output with git describe --tags --always on repositories where abbreviation length diverges. Read the git describe documentation and the relevant git2 describe formatting behavior first. Done means the Rust result matches Git's repository-size-dependent hash abbreviation behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100