Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

🤖 tests: lock in git status outgoing-count rename equivalence and clarify index-lock comment

Open Beginner friendly
#7,636 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
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
git, typescript
Domain
devtools, testing

Research direction

Read src/common/utils/git/gitStatus.ts and src/common/utils/git/gitStatus.test.ts to see how outgoing totals are calculated and how the tests create branch histories. Add a tracked-file rename case that compares the script totals with git diff --numstat <merge-base> and fails if -M is removed. Then reword the OUTGOING_STATS comment to identify stale stat information with unchanged file content as the trigger; the test and comment should cover both requested follow-ups.

Written by the indexing model from the issue text.

Description

Refs #7633 (fix for #7626). Two small, non-blocking follow-ups from the final clean-context check of that PR. No behavior bug is known.

1. Test the outgoing-count equivalence of git diff-index -M --numstat

#7633 changed the outgoing line count in src/common/utils/git/gitStatus.ts from the porcelain git diff --numstat "$MERGE_BASE" to the plumbing git diff-index -M --numstat "$MERGE_BASE". No test locks in that the two give the same totals.

A probe on git 2.55.0 (rename a -> a2, edit, delete, staged new file, untracked file) gave identical rows for both commands. Without -M, diff-index reports the rename as a 50-line delete plus a 50-line add, so the count silently doubles if someone drops the flag.

Wanted: one test in src/common/utils/git/gitStatus.test.ts that renames a tracked file on a branch and asserts the script's outgoing totals equal what git diff --numstat <merge-base> reports (or the expected literal 0 0 for a pure rename). It must fail when -M is removed.

2. Make the gitStatus.ts comment name the trigger

The comment above OUTGOING_STATS says the porcelain "refreshes and rewrites the index under its lock even with GIT_OPTIONAL_LOCKS=0". The final check called this unproven. A probe confirms it. Each row is a fresh repo where tracked file a has a stale mtime (touch -d '2 days ago') but unchanged content, and checks whether the .git/index inode changed:

Command GIT_OPTIONAL_LOCKS=0 default
git diff --numstat HEAD rewritten rewritten
git diff --numstat rewritten rewritten
git diff-index -M --numstat HEAD unchanged unchanged
git status --porcelain unchanged rewritten

When only mtimes are touched to "now" (no stale stat info), git diff --numstat left the index unchanged. So the comment is correct, and the diff-index swap is needed (the env var alone does not stop the porcelain git diff rewrite). Wanted: reword the comment to name the trigger: "a tracked file whose stat info is stale but whose content is unchanged". Comment-only change.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $289.76

Dominant language
TypeScript
Stars
2.1k
Forks
140
Avg merge
3h 23m
Merged PRs (30d)
953

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

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 coder/xum

All issues in coder/xum

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.