trace-decision collector does not read a repository with SHA-256 object names

Open Beginner friendly
#32 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
84/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
git, javascript
Domain
tooling

Research direction

Start with tools/trace-decision/collect-lib.mjs, especially the git blame --porcelain parsing pattern and the NOT_COMMITTED object name. Use git init --object-format=sha256 to reproduce the 64-digit mismatch, or inspect git rev-parse --show-object-format as an alternative source of the object length. Done means SHA-256 repositories produce the same commit assignments as SHA-1 repositories while uncommitted lines remain correctly identified.

Written by the indexing model from the issue text.

Description

type/bug
What happens

tools/trace-decision/collect-lib.mjs reads the output of git blame --porcelain with the pattern /^([0-9a-f]{40}) \d+ (\d+)/. It also marks lines that are not committed with an object name of 40 zeros (NOT_COMMITTED).

A repository that uses SHA-256 object names (git init --object-format=sha256) gives names of 64 hexadecimal digits. The pattern then matches no line, so the collector finds no commit for the lines. [INFERENCE] The script then fails or gives a wrong result. I did not run it on a SHA-256 repository.

Expected

The collector reads the commits of the lines in a SHA-256 repository as in a SHA-1 repository.

More information
  • A fix can read the object name length from git rev-parse --show-object-format, or accept 40 or 64 digits in the pattern and in NOT_COMMITTED.
  • Two reviews of the collector found this limit and did not block the merge, because no caller with a SHA-256 repository is known.
Dominant language
Shell
Stars
1
Forks
0
Avg merge
6h 59m
Merged PRs (30d)
26

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from c-w-z/commit-decision-record

All issues in c-w-z/commit-decision-record

Similar issues

More Shell/Bash issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.