From 01aeb2a3265bcafa162987c85dd281981770bba7 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Thu, 26 Feb 2026 16:35:59 +0000 Subject: 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. --- src/bin/git_remote_nostr/push.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/bin/git_remote_nostr/push.rs') 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( let use_pr = parent_is_pr || git_repo.are_commits_too_big_for_patches(ahead); if use_pr { - let tip = ahead.first().context("no commits")?; // ahead is youngest first - let first_commit = ahead.last().context("no commits")?; + let tip = ahead.last().context("no commits")?; // ahead is oldest first (callers reverse it) + let first_commit = ahead.first().context("no commits")?; let push_options_refs: Vec<&str> = git_server_push_options.iter().map(String::as_str).collect(); select_servers_push_refs_and_generate_pr_or_pr_update_event( -- cgit v1.2.3