upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/bin/ngit/main.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-03-05 21:25:50 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-03-05 22:12:07 +0000
commitf6d1e03dc99b3ea48cb6e4bd1d3371dd924a567a (patch)
tree19fb789e83bd8d4ccc25f735a80cf41c0eccad17 /src/bin/ngit/main.rs
parent83b0886b97e2e90e328f91fcfaeb59726c93308f (diff)
fix(pr-checkout): require --force on diverged proposal branch
checkout_patch() previously re-applied the patch chain whenever the local branch tip didn't match the published tip, silently overwriting local amendments and rebased revisions without warning. Now detects the relationship between local and published tips: - up to date: check out as-is - behind (local is ancestor of published): fast-forward, no flag needed - local commits on top (published is ancestor of local): check out as-is - diverged (neither ancestor): bail with guidance, --force to overwrite - published tip not found locally and branch exists: same as diverged Also adds --force flag to `ngit pr checkout` to explicitly opt in to overwriting a diverged branch, covering both local amendments and author force-pushes. Bug discovered during test implementation in tests/ngit_pr_checkout.rs.
Diffstat (limited to 'src/bin/ngit/main.rs')
-rw-r--r--src/bin/ngit/main.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bin/ngit/main.rs b/src/bin/ngit/main.rs
index 215d5dd..599fbe2 100644
--- a/src/bin/ngit/main.rs
+++ b/src/bin/ngit/main.rs
@@ -97,8 +97,8 @@ async fn main() {
97 ) 97 )
98 .await 98 .await
99 } 99 }
100 PrCommands::Checkout { id, offline } => { 100 PrCommands::Checkout { id, force, offline } => {
101 sub_commands::checkout::launch(id, *offline).await 101 sub_commands::checkout::launch(id, *force, *offline).await
102 } 102 }
103 PrCommands::Apply { 103 PrCommands::Apply {
104 id, 104 id,