Skip to content

Accept repositories where .git is a file - #417

Merged
stefanzweifel merged 1 commit into
masterfrom
fix-git-file-repository-check
Oct 22, 2026
Merged

stefanzweifel merged 1 commit into
masterfrom
fix-git-file-repository-check

Conversation

@stefanzweifel

Copy link
Copy Markdown
Owner

Fixes #416

Problem

The repository check used [ -d ".git" ]. In git submodules, linked worktrees and clones made with --separate-git-dir, .git is a file that points to the real git directory. The check failed for these and the action exited with "Not a git repository".

Changes

  • Use [ -e ".git" ] so both a .git directory and a .git file are accepted.
  • Escape the backticks around repository in the error message. Unescaped, bash ran repository as a command substitution (repository: command not found) and the input name was missing from the message.

Tests

New BATS tests cover:

  • a submodule, using an absolute and a relative repository path
  • a clone with --separate-git-dir
  • a linked git worktree
  • the error message no longer producing command not found
  • a non-existing repository directory

The submodule, separate-git-dir and error message tests fail without the entrypoint.sh change.

The repository check used `[ -d ".git" ]`, which fails for git submodules,
linked worktrees and clones made with `--separate-git-dir`. In those cases
`.git` is a file that points to the actual git directory.

Use `-e` instead so both forms are accepted.

Also escape the backticks around `repository` in the error message. Unescaped,
bash ran `repository` as a command substitution and the input name was missing
from the message.

Add tests for submodules (absolute and relative path), `--separate-git-dir`,
linked worktrees, the error message and a non-existing repository directory.

Fixes #416
@stefanzweifel stefanzweifel self-assigned this Oct 22, 2026
@stefanzweifel
stefanzweifel merged commit d0b0110 into master Oct 22, 2026
2 checks passed
@stefanzweifel
stefanzweifel deleted the fix-git-file-repository-check branch October 22, 2026 06:47
samip5 pushed a commit to k8s-gateway/k8s_gateway that referenced this pull request Oct 28, 2026
…action action to v7.2.1 (#400)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [https://github.com/stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action) | action | patch | `v7.2.0` → `v7.2.1` |

---

### Release Notes

<details>
<summary>stefanzweifel/git-auto-commit-action (https://github.com/stefanzweifel/git-auto-commit-action)</summary>

### [`v7.2.1`](https://github.com/stefanzweifel/git-auto-commit-action/blob/HEAD/CHANGELOG.md#v721---2026-10-22)

[Compare Source](stefanzweifel/git-auto-commit-action@v7.2.0...v7.2.1)

##### Fixed

- Accept repositories where .git is a file ([#&#8203;417](stefanzweifel/git-auto-commit-action#417)) [@&#8203;stefanzweifel](https://github.com/@stefanzweifel)
- README: Update actions ([#&#8203;413](stefanzweifel/git-auto-commit-action#413)) [@&#8203;jackbayliss](https://github.com/@jackbayliss)
- Remove unused gitStatusMessage variable in the entrypoint ([#&#8203;415](stefanzweifel/git-auto-commit-action#415)) [@&#8203;ChihweiLHBird](https://github.com/@ChihweiLHBird)

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC42NS41IiwidXBkYXRlZEluVmVyIjoiNDQuNjUuNSIsInRhcmdldEJyYW5jaCI6Im1hc3RlciIsImxhYmVscyI6W119-->

Reviewed-on: https://codeberg.org/k8s-gateway/k8s_gateway/pulls/400
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

repository input doesn't work

1 participant