Skip to content

Commit c098049

Browse files
committed
refactor: rename restack --all-parents flag to --ancestors
The clap long name derived from the `all_parents` field was `--all-parents`, but the README documented `--ancestors` and that name reads better (a branch has one parent; the flag really means all ancestors up to trunk). Rename the field/param to `ancestors` so clap emits `--ancestors`, matching the README. No backwards-compat concern.
1 parent abc7c91 commit c098049

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/llms.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ itself has no notion of the stack; `git-stack` is the bookkeeping that remembers
9696
- `-b`/`--branch <name>` — restack this branch instead of the current one.
9797
- `-f`/`--fetch` — fetch from the remote first.
9898
- `-p`/`--push` — push the branch(es) to the remote after a successful restack.
99-
- `-a`/`--all-parents` — recursively restack every ancestor from trunk up.
99+
- `-a`/`--ancestors` — recursively restack every ancestor from trunk up.
100100
- `-s`/`--squash` — squash all of the branch's commits into one.
101101
- `--continue` — resume a squash interrupted by a conflict (after resolving).
102102
- `--abort` — cancel an in-progress squash and restore the original state.

src/main.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ enum Command {
7575
/// Push any changes up to the remote after restacking.
7676
#[arg(long, short)]
7777
push: bool,
78-
/// Restack all parent branches recursively up to trunk.
78+
/// Recursively restack all ancestors from trunk up to this branch.
7979
#[arg(long, short = 'a', default_value_t = false)]
80-
all_parents: bool,
80+
ancestors: bool,
8181
/// Squash all commits in the branch into a single commit.
8282
#[arg(long, short = 's', default_value_t = false)]
8383
squash: bool,
@@ -348,7 +348,7 @@ fn inner_main() -> Result<()> {
348348
branch,
349349
fetch,
350350
push,
351-
all_parents,
351+
ancestors,
352352
squash,
353353
r#continue,
354354
abort,
@@ -372,7 +372,7 @@ fn inner_main() -> Result<()> {
372372
current_branch,
373373
fetch,
374374
push,
375-
all_parents,
375+
ancestors,
376376
squash,
377377
)
378378
}
@@ -908,7 +908,7 @@ fn restack(
908908
orig_branch: String,
909909
fetch: bool,
910910
push: bool,
911-
all_parents: bool,
911+
ancestors: bool,
912912
squash: bool,
913913
) -> Result<(), anyhow::Error> {
914914
// Hold a repo-scoped advisory lock for the whole restack so a second
@@ -950,7 +950,7 @@ fn restack(
950950
}
951951

952952
// Find starting_branch in the stacks of branches to determine which stack to use.
953-
let plan = state.plan_restack(git_repo, repo, &restack_branch, all_parents)?;
953+
let plan = state.plan_restack(git_repo, repo, &restack_branch, ancestors)?;
954954

955955
// Collect plan into owned data to allow mutable access to state during the loop
956956
let plan_owned: Vec<(String, state::Branch)> = plan

src/state.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,12 @@ impl State {
324324
git_repo: &GitRepo,
325325
repo: &str,
326326
starting_branch: &str,
327-
all_parents: bool,
327+
ancestors: bool,
328328
) -> Result<Vec<RestackStep<'_>>> {
329-
tracing::debug!("Planning restack for {starting_branch} (all_parents={all_parents})");
329+
tracing::debug!("Planning restack for {starting_branch} (ancestors={ancestors})");
330330

331331
// Single-step mode: only restack the target branch onto its immediate parent
332-
if !all_parents {
332+
if !ancestors {
333333
let parent = self
334334
.get_parent_branch_of(repo, starting_branch)
335335
.ok_or_else(|| {

0 commit comments

Comments
 (0)