diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-18 22:00:35 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-18 22:00:35 +0000 |
| commit | 56b3c149df70af5d441e8527ec1225e5038bde8e (patch) | |
| tree | a73be853773a342158cb8032571502afdf369374 /src/bin/git_remote_nostr | |
| parent | 09db17fd719ddd42c5afad24e1a8e71735374f8e (diff) | |
fix: remove outdated patch_supports gate and fix fetch parent fallback
Remove the patch_supports_commit_ids gates in checkout.rs and list.rs
that pre-dated the mbox fallback logic. apply_patch_chain already
handles all fallback cases. Also replace the main-branch TODO fallback
in make_commits_for_proposal with get_parent_commit_from_patch, which
uses timestamp-based best-guess when the parent-commit tag is absent.
Diffstat (limited to 'src/bin/git_remote_nostr')
| -rw-r--r-- | src/bin/git_remote_nostr/fetch.rs | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/bin/git_remote_nostr/fetch.rs b/src/bin/git_remote_nostr/fetch.rs index 7ee264b..dd80f0f 100644 --- a/src/bin/git_remote_nostr/fetch.rs +++ b/src/bin/git_remote_nostr/fetch.rs | |||
| @@ -10,7 +10,7 @@ use ngit::{ | |||
| 10 | git::{Repo, RepoActions}, | 10 | git::{Repo, RepoActions}, |
| 11 | git_events::{ | 11 | git_events::{ |
| 12 | KIND_PULL_REQUEST, KIND_PULL_REQUEST_UPDATE, | 12 | KIND_PULL_REQUEST, KIND_PULL_REQUEST_UPDATE, |
| 13 | identify_clone_urls_for_oids_from_pr_pr_update_events, tag_value, | 13 | identify_clone_urls_for_oids_from_pr_pr_update_events, |
| 14 | }, | 14 | }, |
| 15 | login::get_curent_user, | 15 | login::get_curent_user, |
| 16 | repo_ref::{RepoRef, is_grasp_server_in_list}, | 16 | repo_ref::{RepoRef, is_grasp_server_in_list}, |
| @@ -126,19 +126,13 @@ pub fn make_commits_for_proposal( | |||
| 126 | patches_ancestor_last: &[Event], | 126 | patches_ancestor_last: &[Event], |
| 127 | ) -> Result<String> { | 127 | ) -> Result<String> { |
| 128 | let patches_ancestor_first: Vec<&Event> = patches_ancestor_last.iter().rev().collect(); | 128 | let patches_ancestor_first: Vec<&Event> = patches_ancestor_last.iter().rev().collect(); |
| 129 | let mut tip_commit_id = if let Ok(parent_commit) = tag_value( | 129 | let first_patch = patches_ancestor_first |
| 130 | patches_ancestor_first | 130 | .first() |
| 131 | .first() | 131 | .context("proposal should have at least one patch")?; |
| 132 | .context("proposal should have at least one patch")?, | 132 | |
| 133 | "parent-commit", | 133 | let mut tip_commit_id = |
| 134 | ) { | 134 | ngit::git_events::get_parent_commit_from_patch(first_patch, Some(git_repo)) |
| 135 | parent_commit | 135 | .context("failed to determine parent commit for proposal")?; |
| 136 | } else { | ||
| 137 | // TODO choose most recent commit on master before patch timestamp so it doesnt | ||
| 138 | // constantly get rebased | ||
| 139 | let (_, hash) = git_repo.get_main_or_master_branch()?; | ||
| 140 | hash.to_string() | ||
| 141 | }; | ||
| 142 | 136 | ||
| 143 | for patch in &patches_ancestor_first { | 137 | for patch in &patches_ancestor_first { |
| 144 | let commit_id = git_repo | 138 | let commit_id = git_repo |