upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/bin/ngit
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/ngit')
-rw-r--r--src/bin/ngit/sub_commands/checkout.rs15
-rw-r--r--src/bin/ngit/sub_commands/list.rs19
2 files changed, 16 insertions, 18 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
diff --git a/src/bin/ngit/sub_commands/list.rs b/src/bin/ngit/sub_commands/list.rs
index 80eec21..133ac83 100644
--- a/src/bin/ngit/sub_commands/list.rs
+++ b/src/bin/ngit/sub_commands/list.rs
@@ -35,7 +35,7 @@ use crate::{
35 git::{Repo, RepoActions, str_to_sha1}, 35 git::{Repo, RepoActions, str_to_sha1},
36 git_events::{ 36 git_events::{
37 commit_msg_from_patch_oneliner, event_is_revision_root, event_to_cover_letter, 37 commit_msg_from_patch_oneliner, event_is_revision_root, event_to_cover_letter,
38 patch_supports_commit_ids, 38 get_parent_commit_from_patch, patch_supports_commit_ids,
39 }, 39 },
40 repo_ref::get_repo_coordinates_when_remote_unknown, 40 repo_ref::get_repo_coordinates_when_remote_unknown,
41}; 41};
@@ -703,15 +703,14 @@ async fn launch_interactive() -> Result<()> {
703 .get_checked_out_branch_name()? 703 .get_checked_out_branch_name()?
704 .eq(&cover_letter.get_branch_name_with_pr_prefix_and_shorthand_id()?); 704 .eq(&cover_letter.get_branch_name_with_pr_prefix_and_shorthand_id()?);
705 705
706 let proposal_base_commit = str_to_sha1(&tag_value( 706 let last_patch = most_recent_proposal_patch_chain_or_pr_or_pr_update
707 most_recent_proposal_patch_chain_or_pr_or_pr_update 707 .last()
708 .last() 708 .context(
709 .context( 709 "there should be at least one patch as we have already checked for this",
710 "there should be at least one patch as we have already checked for this", 710 )?;
711 )?, 711
712 "parent-commit", 712 let proposal_base_commit = str_to_sha1(&get_parent_commit_from_patch(last_patch, Some(&git_repo))?)
713 )?) 713 .context("failed to get valid parent commit id from patch")?;
714 .context("failed to get valid parent commit id from patch")?;
715 714
716 let (main_branch_name, master_tip) = git_repo.get_main_or_master_branch()?; 715 let (main_branch_name, master_tip) = git_repo.get_main_or_master_branch()?;
717 716