Repository navigation
fix: resolve {{ repo }} to project name instead of .git in bare repos - #1545
Closed
worktrunk-bot wants to merge 2 commits into
Closed
worktrunk-bot wants to merge 2 commits into
worktrunk-bot wants to merge 2 commits into
Conversation
In the nested bare repository layout (project/.git as bare repo), the
{{ repo }} template variable resolved to ".git" instead of "project".
Add Repository::repo_name() that handles .git/.bare directory names
by using the parent directory, and strips .git suffixes from bare repo
names like project.git.
Closes #1543
Co-authored-by: Claude <[email protected]>
worktrunk-bot
commented
Mar 15, 2026
worktrunk-bot
left a comment
Collaborator
Author
There was a problem hiding this comment.
Same file_name().unwrap_or(...) pattern exists in two more places that will also resolve to .git in bare repos:
src/llm.rs:551—render_commit_template()src/commands/step_commands.rs:300and:385—run_squash_step()andinspect_squash_prompt()
These use wt.root() but feed the result into the same repo template variable. Should be migrated to repo.repo_name() for consistency.
Happy to push a fix commit.
Same bare-repo bug existed in llm.rs and step_commands.rs where
{{ repo }} would resolve to ".git" instead of the project name.
Co-Authored-By: Claude <[email protected]>
worktrunk-bot
added a commit
that referenced
this pull request
Mar 16, 2026
Previously, claude-mention triggered on `issues: [opened, edited]` while claude-issue-triage skipped issues mentioning @worktrunk-bot. This caused races when a user both commented on an existing issue and filed a new one — two workflows independently created fix PRs for the same bug (#1544/#1545). Now triage handles all new issues (including @worktrunk-bot mentions), and mention only triggers on issue edits. This eliminates the race for new issues while preserving the ability to summon the bot by editing an existing issue. Ref: #1548 (comment) Co-Authored-By: Claude Opus 4.6 <[email protected]>
Owner
|
using #1281 |
max-sixty
pushed a commit
that referenced
this pull request
Mar 21, 2026
…ixes (#1548) ## Problem When a user both comments on an existing issue AND files a new issue within seconds (as happened with #1279/#1543), two independent workflows (`claude-mention` and `claude-issue-triage`) race to create fix PRs. This produced duplicate PRs #1544 and #1545, which modify the exact same 6 files with nearly identical changes. The review bot then reviewed both PRs independently and even posted misleading feedback on #1545 — flagging "missing" call site migrations in `src/llm.rs` and `src/commands/step_commands.rs` that PR #1544 already handles. **Evidence:** Run 23121388888 (review of #1545) posted a COMMENT suggesting files that the sibling PR #1544 already covers. Run 23121179226 (review of #1544) found no issues but didn't detect the duplication either. This is a variant of #1428 but affects user-triggered events (not bot-authored), so the existing bot-author filter from #1429 doesn't help. ## Fix Add a new **Step 2: Check for overlapping PRs** to the review-pr skill. Before reading the diff, the reviewer checks whether other open bot-authored PRs touch the same files. If overlap is found, it's flagged in the review so one can be closed as a duplicate. Also renumbers subsequent steps (3→4, 4→5, etc.) and updates internal cross-references. ## Why this approach - **Catches duplicates at review time** — the cheapest point to detect, since both PRs exist by then - **Doesn't require workflow coordination** — no locking or inter-workflow communication needed - **Low false-positive risk** — overlapping files on bot PRs with similar fixes is a strong signal The underlying race between triage and mention workflows remains (fixing that would require cross-workflow locking), but this ensures the reviewer surfaces the duplication for human action. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: worktrunk-bot <[email protected]> Co-authored-by: Claude <[email protected]>
max-sixty
pushed a commit
that referenced
this pull request
Nov 28, 2026
…#4908) `{{ repo }}` in commit and squash prompt templates now renders the repository's name in every worktree. Before, it rendered the current worktree's folder name, so a custom template run from a linked worktree at `~/code/myrepo.feature` got `myrepo.feature`. A hook in the same worktree gets `myrepo`, and [the LLM commits docs](https://worktrunk.dev/llm-commits/) describe the variable as "Repository name". The three prompt sites (`build_commit_prompt`, the squash preview, the squash run) each derived the name from `wt.root()`. They now share `llm::prompt_repo_name`, which reads `Repository::repo_path()`, the same source `build_hook_context` and the worktree-path template use. The default templates don't reference `{{ repo }}`, so only custom templates are affected. One effect to know about: in a nested bare layout (`project/.git` with worktrees beside it), the prompt's `repo` changes from the worktree's folder name (e.g. `main`) to `.git`. That's the value hooks already get there. Naming bare repos better was discussed in #1281, #1544 and #1545, and this PR doesn't change that. The new test `test_prompt_repo_names_the_repository_from_a_linked_worktree` covers `commit --show-prompt`, `squash --show-prompt`, `squash --dry-run`, and a real squash, all from a linked worktree. On `main` it fails with `repo=repo.feature`; with the fix it passes. The `merge::` and `bare_repository::` integration tests also pass locally, except `test_merge_no_ff_signs_merge_commit`, which fails the same way on `main` in this sandbox (ssh refuses the test's signing key because its file permissions are too open). Co-authored-by: worktrunk-bot <[email protected]>
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.
Problem
In the nested bare repository layout (
project/.gitas bare repo), the{{ repo }}template variable resolved to.gitinstead of the project name. This made features like subdomain routing with Caddy unusable since all repos shared the same name.This is a regression/re-report of #1279, whose fix branch was never merged.
Solution
Add
Repository::repo_name()that derives a human-readable name fromrepo_path():project/.git→"project"(parent directory name)project/.bare→"project"(parent directory name)project.git→"project"(strip.gitsuffix)project→"project"(normal repos unchanged)Updated
build_hook_context()andcompute_worktree_path()to use the new method.Testing
Added
test_nested_bare_repo_template_var_repo_nameintegration test that creates aproject/.gitbare repo layout, configures a hook using{{ repo }}, and verifies it resolves to"project".Closes #1543 — automated triage