diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-26 16:35:59 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-26 16:35:59 +0000 |
| commit | 01aeb2a3265bcafa162987c85dd281981770bba7 (patch) | |
| tree | 76fe39f85d24a68586bdc282088b11474e3751d4 /src/bin/git_remote_nostr | |
| parent | 54f0542a27e4ccab459d87283e4668d865ddd2bb (diff) | |
fix: correct merge-base in PR events from git push of pr/ branch
When pushing a pr/ branch, the ahead slice is reversed by callers before
being passed to generate_patches_or_pr_event_or_pr_updates, making it
oldest-first. The tip/first_commit assignments were backwards (using
first()/last() as if the slice were youngest-first), so the merge-base
was computed as the parent of the PR tip rather than the parent of the
oldest commit. Multi-commit PRs therefore showed only 1 commit when
applied via ngit apply.
Adds an integration test that pushes a two-commit large-file PR branch
and asserts the merge-base tag equals the main branch tip.
Diffstat (limited to 'src/bin/git_remote_nostr')
| -rw-r--r-- | src/bin/git_remote_nostr/push.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs index bd1188b..870f22d 100644 --- a/src/bin/git_remote_nostr/push.rs +++ b/src/bin/git_remote_nostr/push.rs | |||
| @@ -623,8 +623,8 @@ async fn generate_patches_or_pr_event_or_pr_updates( | |||
| 623 | let use_pr = parent_is_pr || git_repo.are_commits_too_big_for_patches(ahead); | 623 | let use_pr = parent_is_pr || git_repo.are_commits_too_big_for_patches(ahead); |
| 624 | 624 | ||
| 625 | if use_pr { | 625 | if use_pr { |
| 626 | let tip = ahead.first().context("no commits")?; // ahead is youngest first | 626 | let tip = ahead.last().context("no commits")?; // ahead is oldest first (callers reverse it) |
| 627 | let first_commit = ahead.last().context("no commits")?; | 627 | let first_commit = ahead.first().context("no commits")?; |
| 628 | let push_options_refs: Vec<&str> = | 628 | let push_options_refs: Vec<&str> = |
| 629 | git_server_push_options.iter().map(String::as_str).collect(); | 629 | git_server_push_options.iter().map(String::as_str).collect(); |
| 630 | select_servers_push_refs_and_generate_pr_or_pr_update_event( | 630 | select_servers_push_refs_and_generate_pr_or_pr_update_event( |