Skip to content

feat: rewrite#3

Merged
sindrip merged 2 commits intomainfrom
passthrough
Mar 11, 2026
Merged

feat: rewrite#3
sindrip merged 2 commits intomainfrom
passthrough

Conversation

@sindrip
Copy link
Owner

@sindrip sindrip commented Mar 11, 2026

No description provided.

@sindrip
Copy link
Owner Author

sindrip commented Mar 11, 2026

Code review

Found 3 issues:

  1. Regression: basename(root) reverses bugfix from commit 00480a7 in add.ts and remove.ts. Commit 00480a7 ("fix: set fetch and derive repo name") specifically fixed a bug where workspace files were named after the local directory instead of the remote repo name. The rewrite reverts to basename(root), which means add and remove will write to a different .code-workspace file than the one clone created (which correctly uses the passed name). This causes workspace file corruption in normal usage when the local directory name differs from the repo name.

.quiet();
await syncWorkspace(root, basename(root));
}

await git.worktree("remove", branch);
await syncWorkspace(root, basename(root));
}

  1. join(branch) in add.ts is a no-op -- join("foo") returns "foo". The old code used join(root, branch) to produce an absolute path. git worktree add <path> resolves the path relative to cwd, not relative to the -C directory. When called from a nested subdirectory (which add.test.ts explicitly tests), the worktree will be created in the wrong location.

const git = await new Git().root();
const root = await git.rootDir();
await git.worktree("add", join(branch));
await git

  1. Workspace file creation test deleted with no replacement. The test "clone creates a workspace file" was removed from clone.test.ts and no test anywhere verifies that syncWorkspace produces a correctly named or correctly populated .code-workspace file. Combined with issue feat: add/remove/code-workspaces #1 above, the basename(root) regression is now undetectable by tests.

https://github.com/sindrip/git-witty/blob/13c63340e38d59132b4a77b418b99b8ea7462c99/src/commands/clone.test.ts#L1-L65

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@sindrip sindrip merged commit 8b9e075 into main Mar 11, 2026
1 check passed
@sindrip sindrip deleted the passthrough branch March 11, 2026 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant