Address review of projects-as-worktree (#34): git-repo check, doc comments, docs#36
Merged
Merged
Conversation
Follow-ups from reviewing the ctrl+g "open project as a git worktree" feature: - projects.go: drop the dead filepath.IsAbs check (Abs already returns an absolute path), and pre-check that the directory is inside a git work tree so ctrl+g on a non-repo project gives a clear "not a git repository" error instead of herdr's raw worktree_create_failed. The check defers to herdr when git itself can't run. - Add doc comments to the new functions/methods that were missing them (worktreeCreate, PluginConfig, configFilePath, loadPluginConfig, openProjectAsWorktree, resolveWorktreeBranch, updateBranch, promptWorktreeBranch, branchView), matching the rest of the codebase. - README: clarify that opening a project as a worktree fills its tabs from a matching worktrees/ layout, NOT the project's own [[tabs]] — and opens bare without one. - Fix stale copied-header dates on the new files. - projects_test.go: cover isInsideGitWorkTree.
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.
Follow-up to #34 (thanks again @dvic!) addressing the review notes on the
ctrl+g"open highlighted project as a git worktree" feature.Changes
Correctness / UX
!filepath.IsAbs(dir)check inopenProjectAsWorktreecould never be true —filepath.Absalready returns an absolute path (or an error, already handled).openProjectAsWorktreenow pre-checks that the directory is inside a git work tree viaisInsideGitWorkTree.ctrl+gon a project whoseworking_dirisn't a git repo now returnsnot a git repository: … (opening as a worktree requires one)instead of herdr's rawworktree_create_failed. The check defers to herdr when git itself can't run, so a missing git never wrongly blocks.Docs / consistency
worktreeCreate,PluginConfig,configFilePath,loadPluginConfig,openProjectAsWorktree,resolveWorktreeBranch,updateBranch,promptWorktreeBranch,branchView), matching the rest of the codebase.worktrees/worktree auto-layout — not the project's own[[tabs]]— and opens bare without one. This coupling was previously invisible.Tests
projects_test.gocoversisInsideGitWorkTree(plain dir vsgit init).Verification
go build,go test, andgo vetall pass; the new git check test does a realgit initand passes.Note: the "tabs come from the worktree layout, not the project" behavior is documented rather than changed — falling back to the project's own tabs would risk double-applying against the
worktree.createdevent handler. Happy to add that fallback separately if we wantctrl+gto work standalone without aworktrees/file.