Skip to content

Commit be0aa25

Browse files
skarimCopilot
andcommitted
rename recover to abort
Co-authored-by: Copilot <copilot@github.com>
1 parent f20a0a3 commit be0aa25

3 files changed

Lines changed: 15 additions & 15 deletions

File tree

cmd/modify.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import (
1313
)
1414

1515
type modifyOptions struct {
16-
recover bool
17-
cont bool
16+
abort bool
17+
cont bool
1818
}
1919

2020
func ModifyCmd(cfg *config.Config) *cobra.Command {
@@ -34,8 +34,8 @@ Operations available:
3434
All changes are staged in the TUI and applied together when you press Ctrl+S.
3535
After applying, run 'gh stack submit' to push changes and recreate the stack on GitHub.`,
3636
RunE: func(cmd *cobra.Command, args []string) error {
37-
if opts.recover {
38-
return runModifyRecover(cfg)
37+
if opts.abort {
38+
return runModifyAbort(cfg)
3939
}
4040
if opts.cont {
4141
return runModifyContinue(cfg)
@@ -44,7 +44,7 @@ After applying, run 'gh stack submit' to push changes and recreate the stack on
4444
},
4545
}
4646

47-
cmd.Flags().BoolVar(&opts.recover, "recover", false, "Recover from a crashed modify session")
47+
cmd.Flags().BoolVar(&opts.abort, "abort", false, "Abort the modify session and restore the stack to its pre-modify state")
4848
cmd.Flags().BoolVar(&opts.cont, "continue", false, "Continue after resolving conflicts")
4949

5050
return cmd
@@ -125,7 +125,7 @@ func runModify(cfg *config.Config) error {
125125
cfg.Printf("")
126126

127127
cfg.Printf("Or restore the stack to its pre-modify state with `%s`",
128-
cfg.ColorCyan("gh stack modify --recover"))
128+
cfg.ColorCyan("gh stack modify --abort"))
129129
return ErrConflict
130130
}
131131

@@ -170,8 +170,8 @@ func printModifySuccess(cfg *config.Config, result *modifyview.ApplyResult, hasR
170170
}
171171
}
172172

173-
// runModifyRecover handles recovery from a crashed modify session.
174-
func runModifyRecover(cfg *config.Config) error {
173+
// runModifyAbort handles recovery to a pre-modify state.
174+
func runModifyAbort(cfg *config.Config) error {
175175
gitDir, err := git.GitDir()
176176
if err != nil {
177177
cfg.Errorf("not a git repository")
@@ -185,7 +185,7 @@ func runModifyRecover(cfg *config.Config) error {
185185
}
186186

187187
if state == nil {
188-
cfg.Printf("No modify session to recover")
188+
cfg.Printf("No modify session to abort")
189189
return nil
190190
}
191191

@@ -301,13 +301,13 @@ func checkNoModifyInProgress(cfg *config.Config, gitDir string) error {
301301
case "applying":
302302
cfg.Errorf("a previous modify session was interrupted")
303303
cfg.Printf("Run `%s` to restore your stack",
304-
cfg.ColorCyan("gh stack modify --recover"))
304+
cfg.ColorCyan("gh stack modify --abort"))
305305
return ErrModifyRecovery
306306
case "conflict":
307307
cfg.Errorf("a modify has unresolved conflicts")
308308
cfg.Printf("Run `%s` to continue, or `%s` to restore your stack",
309309
cfg.ColorCyan("gh stack modify --continue"),
310-
cfg.ColorCyan("gh stack modify --recover"))
310+
cfg.ColorCyan("gh stack modify --abort"))
311311
return ErrSilent
312312
case "pending_submit":
313313
cfg.Errorf("a modify was completed but the stack has not been submitted yet")

internal/modify/apply.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ func ContinueApply(
592592
cfg.ColorCyan("git add <file>"),
593593
cfg.ColorCyan("gh stack modify --continue"))
594594
cfg.Printf("Or restore the stack with `%s`",
595-
cfg.ColorCyan("gh stack modify --recover"))
595+
cfg.ColorCyan("gh stack modify --abort"))
596596
return fmt.Errorf("rebase conflict on %s", branchName)
597597
}
598598

@@ -690,7 +690,7 @@ func Unwind(cfg *config.Config, gitDir string, snapshot Snapshot, stackIndex int
690690
return nil
691691
}
692692

693-
// UnwindFromStateFile restores the stack from a modify state file (for --recover).
693+
// UnwindFromStateFile restores the stack from a modify state file (for --abort).
694694
func UnwindFromStateFile(cfg *config.Config, gitDir string) error {
695695
state, err := LoadState(gitDir)
696696
if err != nil {

internal/modify/state.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ func CheckStateGuard(gitDir string) error {
115115
return nil
116116
}
117117
if state.Phase == "applying" {
118-
return fmt.Errorf("a modify session was interrupted — run `gh stack modify --recover` to restore your stack")
118+
return fmt.Errorf("a modify session was interrupted — run `gh stack modify --abort` to restore your stack")
119119
}
120120
if state.Phase == "conflict" {
121-
return fmt.Errorf("a modify has unresolved conflicts — run `gh stack modify --continue` or `gh stack modify --recover`")
121+
return fmt.Errorf("a modify has unresolved conflicts — run `gh stack modify --continue` or `gh stack modify --abort`")
122122
}
123123
return nil
124124
}

0 commit comments

Comments
 (0)