Skip to content

Commit f827ea6

Browse files
bukzorclaude
andcommitted
Treat gitfile .git as out of scope (worktree/submodule)
A regular-file .git is a worktree or submodule pointer (gitfile), not a real gitdir we should relocate. Skip it in all three hooks (-L || -f) and short-circuit cleanly in the relocator instead of tripping the not-a-directory assertion. Widen that assertion's wording accordingly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent dda3f05 commit f827ea6

4 files changed

Lines changed: 13 additions & 5 deletions

File tree

.local/share/git-localhost-store/bin/git-localhost-store

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,14 @@ if [ -L .git ]; then
2121
exit 0
2222
fi
2323

24+
if [ -f .git ]; then
25+
gitfile="$(cat .git)"
26+
echo "git-localhost-store: ✓ Gitfile (worktree/submodule), out of scope: $gitfile" >&2
27+
exit 0
28+
fi
29+
2430
if [ ! -d .git ]; then
25-
echo "❌ .git is not a directory (got: $(ls -ld .git 2>&1))" >&2
31+
echo "git-localhost-store: ❌ .git is not a directory, symlink, or gitfile (got: $(ls -ld .git 2>&1))" >&2
2632
exit 1
2733
fi
2834

.local/share/git-localhost-store/template-repo/hooks/post-index-change

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ if (( DEBUG > 0 )); then
99
: post-index-change "$@"
1010
fi
1111

12-
if [ -L .git ]; then
12+
if [ -L .git ] || [ -f .git ]; then
13+
: Nothing to convert.
1314
exit 0
1415
fi
1516

.local/share/git-localhost-store/template-repo/hooks/pre-commit

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ if (( DEBUG > 0 )); then
99
: pre-commit "$@"
1010
fi
1111

12-
if [ -L .git ]; then
12+
if [ -L .git ] || [ -f .git ]; then
13+
: Nothing to convert.
1314
exit 0
1415
fi
1516

.local/share/git-localhost-store/template-repo/hooks/reference-transaction

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ if [[ "${1:-}" != "committed" ]]; then
1414
exit 0
1515
fi
1616

17-
# Already converted: .git is a symlink, not a real directory.
18-
if [ -L .git ]; then
17+
if [ -L .git ] || [ -f .git ]; then
18+
: Nothing to convert.
1919
exit 0
2020
fi
2121

0 commit comments

Comments
 (0)