test/shamhub: Scope bare-repo git commands with --git-dir#1261
Merged
Conversation
Collaborator
Author
|
This change is part of the following stack: Change managed by git-spice. |
cbb4a72 to
e21c83a
Compare
e21c83a to
dd0a8c2
Compare
This was referenced Jun 24, 2026
dd0a8c2 to
a6814a6
Compare
git 2.50 no longer auto-discovers a bare repository from cwd alone, so running commands like `git config`, `git show-ref`, and `git rev-parse` via WithDir(repoDir(...)) fails with "fatal: not in a git directory". This broke every shamhub-backed script test. Add a `(*ShamHub).gitCmd(ctx, owner, repo, args...)` helper that prefixes the command with `--git-dir <bare-repo>` and replace each WithDir-on- bare-repo call site with it. Behavior is unchanged on older git versions; tests now pass on 2.50+.
a6814a6 to
1692c83
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
git 2.50 no longer auto-discovers a bare repository from cwd alone, so
running commands like
git config,git show-ref, andgit rev-parsevia WithDir(repoDir(...)) fails with "fatal: not in a git directory".
This broke every shamhub-backed script test.
Add a
(*ShamHub).gitCmd(ctx, owner, repo, args...)helper that prefixesthe command with
--git-dir <bare-repo>and replace each WithDir-on-bare-repo call site with it. Behavior is unchanged on older git
versions; tests now pass on 2.50+.