diff options
Diffstat (limited to 'src/bin/git_remote_nostr/fetch.rs')
| -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 |