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
16 changes: 4 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -553,19 +553,12 @@ stages the mirror content removal and `.braids.json` update.

### Remotes, Cache, And Paths

Braid normally creates Git remotes as needed and removes them when the command
finishes. Use `setup` when you want Braid-managed remotes to exist in the
repository, for example before inspecting them with Git:

```bash
braid setup
braid setup vendor/rails --force
```
Braid creates Git remotes as needed and removes them when the command finishes.

The local cache is enabled by default. Without overrides, Braid stores
repository-local per-mirror bare caches under `.git/braid/cache`. These caches
are implementation state and can be rebuilt by `braid add`, `braid setup`,
`braid status`, `braid pull`, `braid diff`, `braid push`, or `braid sync` while
are implementation state and can be rebuilt by `braid add`, `braid status`,
`braid pull`, `braid diff`, `braid push`, or `braid sync` while
the upstream still serves the recorded revisions from `.braids.json`.

Repository-local caches are shallow for common branch, tag, and full-SHA
Expand All @@ -590,7 +583,7 @@ lookup or storage. Absolute `local_path` inputs are accepted only when they are
inside the Git working tree, and stored config paths remain relative.

Commands without a `local_path`, such as `braid status`, `braid diff`,
`braid setup`, `braid pull`, and `braid sync`, operate on the repository-wide
`braid pull`, and `braid sync`, operate on the repository-wide
mirror set from any subdirectory. Relative `--global-cache-dir` values and
`BRAID_GLOBAL_CACHE_DIR` values remain relative to the process directory. Git
diff arguments after `braid diff ... --` are passed through as raw `git diff`
Expand Down Expand Up @@ -622,7 +615,6 @@ includes it.
| `push` | Push committed local mirror changes upstream. |
| `sync [local_path...] [--pull-only] [--autostash] [--keep]` | Push changed branch mirrors, then pull selected mirrors. |
| `remove [--no-commit]` | Remove mirrored content and config. |
| `setup` | Add or refresh Braid-managed Git remotes. |
| `version` | Print the Braid version. |
| `completion bash` | Print the Bash completion script. |

Expand Down
11 changes: 4 additions & 7 deletions docs/migration-from-ruby-braid.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Comparison baseline:

The Go tool keeps the core modern Braid model: mirrors are recorded in
`.braids.json`, mirror content is copied into the downstream repository, and the
main workflows are `add`, `status`, `diff`, `pull`, `push`, `setup`, and
main workflows are `add`, `status`, `diff`, `pull`, `push`, and
`remove`. `pull` is the documented spelling for updating mirror content;
`update` and `up` are accepted aliases. The differences below are the parts most
likely to matter in day to day use or automation.
Expand Down Expand Up @@ -51,7 +51,7 @@ worktree.
When a command takes a mirror path, the path is resolved relative to the
directory where Braid was invoked and stored in `.braids.json` as a
repo-root-relative path. Commands without a path, such as `braid status`,
`braid diff`, `braid pull`, `braid sync`, and `braid setup`, still operate on
`braid diff`, `braid pull`, and `braid sync`, still operate on
the repository-wide mirror set.

Migration impact:
Expand Down Expand Up @@ -150,7 +150,7 @@ Migration impact:

| Area | Ruby Braid | Current Go Braid | Migration impact |
| --- | --- | --- | --- |
| Commands | `add`, `update`, `remove`, `diff`, `push`, `setup`, `version`, `status`, `upgrade-config` | `pull` is the documented mirror-update command; `update` and `up` are aliases; same other core commands, plus `sync`; `upgrade-config` migrates versioned JSON config | Prefer `pull` in new docs and scripts. Use Go Braid's `upgrade-config` only for `.braids.json` version 1 to 2 migration. |
| Commands | `add`, `update`, `remove`, `diff`, `push`, `setup`, `version`, `status`, `upgrade-config` | `pull` is the documented mirror-update command; `update` and `up` are aliases; `setup` is removed; the other core commands remain, plus `sync`; `upgrade-config` migrates versioned JSON config | Remove `setup` from scripts, prefer `pull` in new docs and scripts, and use Go Braid's `upgrade-config` only for `.braids.json` version 1 to 2 migration. |
| Help form | `braid help`, `braid add help`, `braid add --help`; the old README also advertised `braid help add`, but the `v1.1.10` gem does not provide command-specific help through that form | `braid help`, `braid add help`, `braid add --help` | Prefer `braid <command> help` or `braid <command> --help`. |
| Verbose flag | Per-command `--verbose`/`-v` | Global `--verbose`/`-v` before the command | Use `braid -v pull ...`, not `braid pull -v ...`. |
| Quiet flag | No global quiet flag | Global `--quiet` before the command; incompatible with `--verbose` | Use `braid --quiet <command> ...` in automation that wants data, warnings, errors, and recovery output without progress or informational chatter. |
Expand All @@ -160,7 +160,6 @@ Migration impact:
| `update` without path | Updates all configured mirrors through Ruby's all-update flow | `pull` without a path updates branch/tag mirrors in lexicographic path order, skips revision-locked mirrors, and reports skipped paths; `update` and `up` behave the same way | Locked mirrors are no longer touched by all-update. |
| Strategy flags with no-path `update` | Accepted by the Ruby parser, with inconsistent all-mirror behavior | Rejected for no-path `pull` and its aliases | Pass a local path when changing branch, tag, or revision. |
| `diff` pass-through | Arguments after `--` are passed to `git diff` | Same | Output formatting is not exact Ruby text parity. |
| `setup --force` and command `--keep` | Supported | Supported where relevant | Remote cleanup behavior is broadly preserved. |

## Configuration Compatibility

Expand Down Expand Up @@ -241,8 +240,6 @@ Current controls:
Migration impact:

- Do not depend on the old `~/.braid/cache` layout or old cache path names.
- Braid-managed remotes created by `setup` may point at repository-local cache
paths under `.git/braid/cache`.
- Repository-local caches are disposable. If one is deleted, Braid can rebuild it
only while upstream still serves the recorded revisions from `.braids.json`.
Shallow repository-local caches can also make Git report the downstream
Expand Down Expand Up @@ -287,7 +284,7 @@ Go Braid intentionally restores Ruby-like feedback for operations that may
contact upstream repositories or the local cache. It prints semantic start and
completion progress to `stderr` for cache updates, mirror fetches, pull checks,
mirror updates, upstream pushes, status remote checks, diff remote hydration,
and setup remote changes. Interactive terminals append `.` about every five
and temporary remote changes. Interactive terminals append `.` about every five
seconds during long-running operations; non-interactive output is line-based.

The stream contract is explicit:
Expand Down
9 changes: 0 additions & 9 deletions integration/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,6 @@ go_test(
timeout = "short",
)

go_test(
name = "configure_failure_command_test",
size = "medium",
srcs = ["setup_failure_test.go"],
data = ["//cmd/braid"],
embed = [":test_support"],
timeout = "short",
)

go_test(
name = "scoped_state_test",
size = "medium",
Expand Down
25 changes: 0 additions & 25 deletions integration/lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,31 +49,6 @@ func TestExecutablePrimaryLifecycle(t *testing.T) {
assertPathExists(t, filepath.Join(cacheRemoteURL, "HEAD"))
assertClean(t, env, downstream)

setup := runBraid(t, env, downstream, braid, "setup", localPath)
assertExit(t, setup, 0)
assertEmpty(t, "setup stdout", setup.stdout)
assertProgress(t, setup.stderr,
"Braid: updated cache for mirror "+localPath,
"Braid: setting up mirror remote "+localPath,
"Braid: set up mirror remote "+localPath,
)
assertRemoteURL(t, env, downstream, remote, cacheRemoteURL)

gitOK(t, env, downstream, "remote", "set-url", remote, "manual-url")
setupReuse := runBraid(t, env, downstream, braid, "setup", localPath)
assertResult(t, setupReuse, 0, "", "")
assertRemoteURL(t, env, downstream, remote, "manual-url")

setupForce := runBraid(t, env, downstream, braid, "setup", localPath, "--force")
assertExit(t, setupForce, 0)
assertEmpty(t, "setup force stdout", setupForce.stdout)
assertProgress(t, setupForce.stderr,
"Braid: updated cache for mirror "+localPath,
"Braid: setting up mirror remote "+localPath,
"Braid: set up mirror remote "+localPath,
)
assertRemoteURL(t, env, downstream, remote, cacheRemoteURL)

status := runBraid(t, env, downstream, braid, "status", localPath)
assertExit(t, status, 0)
assertProgress(t, status.stderr,
Expand Down
3 changes: 1 addition & 2 deletions integration/no_commit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,8 @@ func TestExecutableNoCommitAddUpdateRemoveWorkflow(t *testing.T) {
}
commitAll(t, env, downstream, "combined update")

setup := runBraid(t, env, downstream, braid, "setup", "vendor/basic")
assertExit(t, setup, 0)
remote := remoteName("main", "vendor/basic")
gitOK(t, env, downstream, "remote", "add", remote, repositoryCachePath(t, downstream, "vendor/basic", configMirror{URL: upstream, Branch: "main"}))
writeFile(t, downstream, "remove-staged.txt", "remove staged\n")
gitOK(t, env, downstream, "add", "remove-staged.txt")
removeHead := gitOutput(t, env, downstream, "rev-parse", "HEAD")
Expand Down
117 changes: 0 additions & 117 deletions integration/setup_failure_test.go

This file was deleted.

4 changes: 0 additions & 4 deletions integration/subdirectory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ func TestExecutableSubdirectoryLifecycle(t *testing.T) {
localPath: {URL: upstream, Branch: "main", Revision: baseRevision},
})

setup := runBraid(t, env, workDir, braid, "--quiet", "setup", "vendor/basic")
assertResult(t, setup, 0, "", "")
assertRemoteURL(t, env, downstream, remote, repositoryCachePath(t, downstream, localPath, configMirror{URL: upstream, Branch: "main"}))

status := runBraid(t, env, workDir, braid, "--quiet", "status", "vendor/basic")
assertExit(t, status, 0)
assertEmpty(t, "subdir status stderr", status.stderr)
Expand Down
5 changes: 0 additions & 5 deletions integration/support.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,6 @@ func assertConfigRaw(t *testing.T, repo string, mirrors map[string]configMirror)
}
}

func cachePath(cacheDir, url string) string {
sum := sha256.Sum256([]byte(url))
return filepath.Join(cacheDir, hex.EncodeToString(sum[:]))
}

func repositoryCachePath(t *testing.T, repo, localPath string, m configMirror) string {
t.Helper()
cacheDir := filepath.Join(processWorkingDir(t, repo), ".git", "braid", "cache")
Expand Down
34 changes: 0 additions & 34 deletions internal/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const (
CommandDiff Command = "diff"
CommandPush Command = "push"
CommandSync Command = "sync"
CommandSetup Command = "setup"
CommandVersion Command = "version"
CommandStatus Command = "status"
CommandCompletion Command = "completion"
Expand Down Expand Up @@ -81,11 +80,6 @@ type SyncOptions struct {
Keep bool
}

type SetupOptions struct {
LocalPath string
Force bool
}

type StatusOptions struct {
LocalPath string
}
Expand All @@ -110,7 +104,6 @@ type Invocation struct {
Diff DiffOptions
Push PushOptions
Sync SyncOptions
Setup SetupOptions
Status StatusOptions
Completion CompletionOptions
Complete CompleteOptions
Expand Down Expand Up @@ -142,7 +135,6 @@ func New() App {
CommandDiff: notImplemented(CommandDiff),
CommandPush: notImplemented(CommandPush),
CommandSync: notImplemented(CommandSync),
CommandSetup: notImplemented(CommandSetup),
CommandStatus: notImplemented(CommandStatus),
CommandUpgradeConfig: notImplemented(CommandUpgradeConfig),
},
Expand Down Expand Up @@ -268,8 +260,6 @@ func Parse(args []string) (Invocation, error) {
return inv, parsePush(commandArgs, &inv.Push)
case CommandSync:
return inv, parseSync(commandArgs, &inv.Sync)
case CommandSetup:
return inv, parseSetup(commandArgs, &inv.Setup)
case CommandVersion:
return inv, requireNoArgs("version", commandArgs)
case CommandStatus:
Expand Down Expand Up @@ -470,25 +460,6 @@ func parseSync(args []string, options *SyncOptions) error {
return nil
}

func parseSetup(args []string, options *SetupOptions) error {
var positionals []string
err := parseCommandArgs(CommandSetup, args, []flagSpec{
boolFlag("--force", "-f", func() { options.Force = true }),
}, func(pos []string, _ []string) {
positionals = pos
})
if err != nil {
return err
}
if err := requireArgRange("setup", positionals, 0, 1); err != nil {
return err
}
if len(positionals) == 1 {
options.LocalPath = normalizeLocalPathArg(positionals[0])
}
return nil
}

func parseStatus(args []string, options *StatusOptions) error {
var positionals []string
err := parseCommandArgs(CommandStatus, args, nil, func(pos []string, _ []string) {
Expand Down Expand Up @@ -635,8 +606,6 @@ func parseCommand(value string) (Command, bool) {
return CommandPush, true
case string(CommandSync):
return CommandSync, true
case string(CommandSetup):
return CommandSetup, true
case string(CommandVersion):
return CommandVersion, true
case string(CommandStatus):
Expand Down Expand Up @@ -688,7 +657,6 @@ commands:
diff Show local mirror changes
push Push local mirror changes upstream
sync Push local mirror changes, then pull mirrors
setup Set up mirror remotes
status Show mirror status
version Show braid version
completion
Expand All @@ -714,8 +682,6 @@ func CommandUsage(command Command) string {
return "usage: braid push <local_path> [--branch|-b <branch>] [--message|-m <message>] [--keep]\n"
case CommandSync:
return "usage: braid sync [local_path...] [--pull-only] [--autostash] [--keep]\n"
case CommandSetup:
return "usage: braid setup [local_path] [--force|-f]\n"
case CommandVersion:
return "usage: braid version\n"
case CommandStatus:
Expand Down
Loading