upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/bin/ngit/sub_commands/checkout.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-02-18 14:48:20 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-02-18 14:48:20 +0000
commitfcff4541e1f36b6575596c353637b25aeae9bdcf (patch)
treed897ce824ca49a8ffef9f55f5f36777687573aab /src/bin/ngit/sub_commands/checkout.rs
parente6bb9effa194fe63b5e969c090dbe6e93f13d312 (diff)
feat: handle missing optional patch tags for pr/ flow
- Add mbox_parser module to extract metadata from patch content - Extract author/committer from From: and Date: headers when tags missing - Extract commit message body as fallback for description tag - Implement best-guess parent commit logic using committer timestamps - Update patch_supports_commit_ids to accept mbox-parseable patches - Enable patches without optional tags to appear as pr/ branches
Diffstat (limited to 'src/bin/ngit/sub_commands/checkout.rs')
-rw-r--r--src/bin/ngit/sub_commands/checkout.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/bin/ngit/sub_commands/checkout.rs b/src/bin/ngit/sub_commands/checkout.rs
index 19e39d0..87f1ff2 100644
--- a/src/bin/ngit/sub_commands/checkout.rs
+++ b/src/bin/ngit/sub_commands/checkout.rs
@@ -24,7 +24,7 @@ use nostr_sdk::{EventId, FromBech32};
24use crate::{ 24use crate::{
25 client::{Client, Connect, fetching_with_report, get_repo_ref_from_cache}, 25 client::{Client, Connect, fetching_with_report, get_repo_ref_from_cache},
26 git::{Repo, RepoActions, str_to_sha1}, 26 git::{Repo, RepoActions, str_to_sha1},
27 git_events::{event_to_cover_letter, patch_supports_commit_ids}, 27 git_events::{event_to_cover_letter, get_parent_commit_from_patch, patch_supports_commit_ids},
28 repo_ref::get_repo_coordinates_when_remote_unknown, 28 repo_ref::get_repo_coordinates_when_remote_unknown,
29}; 29};
30 30
@@ -272,13 +272,12 @@ fn checkout_patch(
272 ); 272 );
273 } 273 }
274 274
275 let proposal_base_commit = str_to_sha1(&tag_value( 275 let last_patch = most_recent_proposal_patch_chain_or_pr_or_pr_update
276 most_recent_proposal_patch_chain_or_pr_or_pr_update 276 .last()
277 .last() 277 .context("there should be at least one patch")?;
278 .context("there should be at least one patch")?, 278
279 "parent-commit", 279 let proposal_base_commit = str_to_sha1(&get_parent_commit_from_patch(last_patch, Some(git_repo))?)
280 )?) 280 .context("failed to get valid parent commit id from patch")?;
281 .context("failed to get valid parent commit id from patch")?;
282 281
283 let (main_branch_name, _master_tip) = git_repo.get_main_or_master_branch()?; 282 let (main_branch_name, _master_tip) = git_repo.get_main_or_master_branch()?;
284 283