Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ Subcommands are explicit. Use `git-worktreeinclude apply ...`.
### Apply

```sh
git-worktreeinclude apply --from auto
git-worktreeinclude apply
```

Or via Git extension:

```sh
git worktreeinclude apply --from auto
git worktreeinclude apply
```

## `.worktreeinclude` semantics

- Place `.worktreeinclude` at the source worktree root (for `--from auto`, this is typically the main worktree).
- Place `.worktreeinclude` at the source worktree root (by default, this is typically the main worktree selected by `--from auto`).
- Format is gitignore-compatible (`#` comments, blank lines, `!` negation, `/` anchors, `**`, etc.).
- `.worktreeinclude` may be tracked, untracked, or ignored; if the file exists in the source worktree, it is used.
- Actual sync target is the intersection of:
Expand Down Expand Up @@ -159,7 +159,7 @@ Run this immediately after creating a worktree:

```sh
git worktree add <path> -b <branch>
git -C <path> worktreeinclude apply --from auto --json
git -C <path> worktreeinclude apply --json
```

- Evaluate success by exit code
Expand All @@ -186,7 +186,7 @@ set -eu

old="$1"
if [ "$old" = "0000000000000000000000000000000000000000" ]; then
git worktreeinclude apply --from auto --quiet || true
git worktreeinclude apply --quiet || true
fi
```

Expand All @@ -201,7 +201,7 @@ fi
Notes:

- `git worktree add --no-checkout` may not trigger `post-checkout`.
- In that case, run `git worktreeinclude apply --from auto` manually.
- In that case, run `git worktreeinclude apply` manually.

## Exit codes

Expand Down
2 changes: 1 addition & 1 deletion internal/cli/cli_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ func TestHookPathAndPrint(t *testing.T) {
if code != 0 {
t.Fatalf("hook print exit code = %d", code)
}
if !strings.Contains(snippet, "git worktreeinclude apply --from auto --quiet || true") {
if !strings.Contains(snippet, "git worktreeinclude apply --quiet || true") {
t.Fatalf("unexpected hook snippet: %s", snippet)
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/cli_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func TestRunHookPrint(t *testing.T) {
if code != exitcode.OK {
t.Fatalf("Run returned %d, want %d; stderr=%s", code, exitcode.OK, stderr.String())
}
if !strings.Contains(stdout.String(), "git worktreeinclude apply --from auto --quiet || true") {
if !strings.Contains(stdout.String(), "git worktreeinclude apply --quiet || true") {
t.Fatalf("unexpected snippet: %q", stdout.String())
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/hooks/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set -eu

old="$1"
if [ "$old" = "0000000000000000000000000000000000000000" ]; then
git worktreeinclude apply --from auto --quiet || true
git worktreeinclude apply --quiet || true
fi
`, nil
default:
Expand Down
2 changes: 1 addition & 1 deletion internal/hooks/hooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func TestPrintSnippetPostCheckout(t *testing.T) {
if err != nil {
t.Fatalf("PrintSnippet returned error: %v", err)
}
if !strings.Contains(got, "git worktreeinclude apply --from auto --quiet || true") {
if !strings.Contains(got, "git worktreeinclude apply --quiet || true") {
t.Fatalf("unexpected snippet: %q", got)
}
}
Expand Down
Loading