Skip to content

test/shamhub: Scope bare-repo git commands with --git-dir#1261

Merged
abhinav merged 1 commit into
mainfrom
ed-irl/shamhub-bare-repo-discovery
Jun 28, 2026
Merged

test/shamhub: Scope bare-repo git commands with --git-dir#1261
abhinav merged 1 commit into
mainfrom
ed-irl/shamhub-bare-repo-discovery

Conversation

@ed-irl

@ed-irl ed-irl commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

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+.

@ed-irl

ed-irl commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator Author

This change is part of the following stack:

Change managed by git-spice.

@ed-irl ed-irl force-pushed the ed-irl/shamhub-bare-repo-discovery branch 2 times, most recently from cbb4a72 to e21c83a Compare June 15, 2026 09:54
@ed-irl ed-irl changed the base branch from main to ed-irl/restack-options-param June 24, 2026 01:33
@ed-irl ed-irl force-pushed the ed-irl/shamhub-bare-repo-discovery branch from e21c83a to dd0a8c2 Compare June 24, 2026 01:33
@abhinav abhinav changed the base branch from ed-irl/restack-options-param to main June 28, 2026 14:05
@abhinav abhinav force-pushed the ed-irl/shamhub-bare-repo-discovery branch from dd0a8c2 to a6814a6 Compare June 28, 2026 14:05
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+.
@abhinav abhinav force-pushed the ed-irl/shamhub-bare-repo-discovery branch from a6814a6 to 1692c83 Compare June 28, 2026 14:06
@abhinav abhinav enabled auto-merge (squash) June 28, 2026 14:06
@abhinav abhinav added the skip changelog PRs that don't need a changelog. label Jun 28, 2026
@abhinav abhinav merged commit 72c298b into main Jun 28, 2026
22 of 23 checks passed
@abhinav abhinav deleted the ed-irl/shamhub-bare-repo-discovery branch June 28, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip changelog PRs that don't need a changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants