{"thread":{"id":"65798","subject":"[PATCH] Add a test about broken notes handling on rebase","startedAt":"2026-06-12T14:40:02Z","lastAt":"2026-06-16T13:12:30Z","messageCount":2,"participants":["Uwe Kleine-König","Phillip Wood"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"545384","messageId":"20260612143952.3281115-2-u.kleine-koenig@baylibre.com","threadId":"65798","inReplyTo":null,"subject":"[PATCH] Add a test about broken notes handling on rebase","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@baylibre.com","sentAt":"2026-06-12T14:39:53Z","receivedAt":"2026-06-12T14:40:02Z","isPatch":true,"body":"When a commit disappears during rebase because the patch content is\nalready there (but not by the same patch in which case the commit would\nbe skipped) the notes of that disappearing commit still survives and is\nadded to the (rebased) parent of the disappearing commit.\n\nSo with the commit graph\n\n A -- B -- C\n  `\n   `-BD\n\nwhere BD includes the changes done in B, when rebasing C on top of BD,\nthe note for B should disappear and not be added to BD.\n\nSigned-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>\n---\nHello,\n\nthis is a behaviour of git that really bothers me when working on big\npatch series. I use notes to track the Message-Id of the patches when I\nsend them out. Then when rebasing to a newer upstream version, the\ntracking gets confused because the Message-Id notes end up on commits\nthat were not sent out yet (or I got two Message-Ids in them).\n\nI reported that already back in 2023[1], but obviously not in a way that\nresulted in a fix. So I'm trying again with a patch that adds a failing\ntest.\n\nBest regards\nUwe\n\n[1] https://lore.kernel.org/git/20230530092155.3zbb5uxa7eisdzxb@pengutronix.de/\n\n t/meson.build           |  1 +\n t/t3322-notes-rebase.sh | 35 +++++++++++++++++++++++++++++++++++\n 2 files changed, 36 insertions(+)\n create mode 100644 t/t3322-notes-rebase.sh\n\ndiff --git a/t/meson.build b/t/meson.build\nindex c5832fee0535..6927bd9c794f 100644\n--- a/t/meson.build\n+++ b/t/meson.build\n@@ -358,6 +358,7 @@ integration_tests = [\n   't3311-notes-merge-fanout.sh',\n   't3320-notes-merge-worktrees.sh',\n   't3321-notes-stripspace.sh',\n+  't3322-notes-rebase.sh',\n   't3400-rebase.sh',\n   't3401-rebase-and-am-rename.sh',\n   't3402-rebase-merge.sh',\ndiff --git a/t/t3322-notes-rebase.sh b/t/t3322-notes-rebase.sh\nnew file mode 100644\nindex 000000000000..64c40a523b50\n--- /dev/null\n+++ b/t/t3322-notes-rebase.sh\n@@ -0,0 +1,35 @@\n+#!/bin/sh\n+\n+test_description='Test notes on rebase'\n+\n+. ./test-lib.sh\n+\n+test_expect_success setup '\n+\tgit init &&\n+\techo A > A &&\n+\tgit add A &&\n+\tgit commit -m A &&\n+\tgit branch branch &&\n+\techo B > B &&\n+\tgit add B &&\n+\tgit commit -m B &&\n+\tgit notes add -m \"This is B\" @ &&\n+\techo C > C &&\n+\tgit add C &&\n+\tgit commit -m C &&\n+\tgit checkout branch &&\n+\techo B > B &&\n+\techo D > D &&\n+\tgit add B D &&\n+\tgit commit -m BD\n+'\n+\n+test_expect_success 'rebase B + C on top of BD' '\n+\tgit rebase @ master\n+'\n+\n+test_expect_failure 'assert there is no note on BD' '\n+\tgit notes show branch\n+'\n+\n+test_done\n\nbase-commit: 3e65291872de10c3f0bf05ea8c24187e7a71ebf0\n-- \n2.47.3\n\n"},{"id":"545655","messageId":"27938b0e-d131-4a44-95bc-c06f4513e542@gmail.com","threadId":"65798","inReplyTo":"20260612143952.3281115-2-u.kleine-koenig@baylibre.com","subject":"Re: [PATCH] Add a test about broken notes handling on rebase","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2026-06-16T13:12:22Z","receivedAt":"2026-06-16T13:12:30Z","isPatch":true,"body":"On 12/06/2026 15:39, Uwe Kleine-König wrote:\n> When a commit disappears during rebase because the patch content is\n> already there (but not by the same patch in which case the commit would\n> be skipped) the notes of that disappearing commit still survives and is\n> added to the (rebased) parent of the disappearing commit.\n> \n> So with the commit graph\n> \n>   A -- B -- C\n>    `\n>     `-BD\n> \n> where BD includes the changes done in B, when rebasing C on top of BD,\n> the note for B should disappear and not be added to BD.\n> \n> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>\n> ---\n> Hello,\n> \n> this is a behaviour of git that really bothers me when working on big\n> patch series. I use notes to track the Message-Id of the patches when I\n> send them out. Then when rebasing to a newer upstream version, the\n> tracking gets confused because the Message-Id notes end up on commits\n> that were not sent out yet (or I got two Message-Ids in them).\n> \n> I reported that already back in 2023[1],\n\nThat thread includes a suggestion on how to fix it if anyone reading \nthis is interesting in working on it.\n\n> but obviously not in a way that\n> resulted in a fix. So I'm trying again with a patch that adds a failing\n> test.\n\nI'm not sure carrying this test makes it any more likely that it will be \nfixed, though your mail might get someone interested in fixing it. Don't \nwe already have some relevant tests t3400 rather than adding a whole new \nfile for a single test?\n\nThanks\n\nPhillip\n\n> Best regards\n> Uwe\n> \n> [1] https://lore.kernel.org/git/20230530092155.3zbb5uxa7eisdzxb@pengutronix.de/\n> \n>   t/meson.build           |  1 +\n>   t/t3322-notes-rebase.sh | 35 +++++++++++++++++++++++++++++++++++\n>   2 files changed, 36 insertions(+)\n>   create mode 100644 t/t3322-notes-rebase.sh\n> \n> diff --git a/t/meson.build b/t/meson.build\n> index c5832fee0535..6927bd9c794f 100644\n> --- a/t/meson.build\n> +++ b/t/meson.build\n> @@ -358,6 +358,7 @@ integration_tests = [\n>     't3311-notes-merge-fanout.sh',\n>     't3320-notes-merge-worktrees.sh',\n>     't3321-notes-stripspace.sh',\n> +  't3322-notes-rebase.sh',\n>     't3400-rebase.sh',\n>     't3401-rebase-and-am-rename.sh',\n>     't3402-rebase-merge.sh',\n> diff --git a/t/t3322-notes-rebase.sh b/t/t3322-notes-rebase.sh\n> new file mode 100644\n> index 000000000000..64c40a523b50\n> --- /dev/null\n> +++ b/t/t3322-notes-rebase.sh\n> @@ -0,0 +1,35 @@\n> +#!/bin/sh\n> +\n> +test_description='Test notes on rebase'\n> +\n> +. ./test-lib.sh\n> +\n> +test_expect_success setup '\n> +\tgit init &&\n> +\techo A > A &&\n> +\tgit add A &&\n> +\tgit commit -m A &&\n> +\tgit branch branch &&\n> +\techo B > B &&\n> +\tgit add B &&\n> +\tgit commit -m B &&\n> +\tgit notes add -m \"This is B\" @ &&\n> +\techo C > C &&\n> +\tgit add C &&\n> +\tgit commit -m C &&\n> +\tgit checkout branch &&\n> +\techo B > B &&\n> +\techo D > D &&\n> +\tgit add B D &&\n> +\tgit commit -m BD\n> +'\n> +\n> +test_expect_success 'rebase B + C on top of BD' '\n> +\tgit rebase @ master\n> +'\n> +\n> +test_expect_failure 'assert there is no note on BD' '\n> +\tgit notes show branch\n> +'\n> +\n> +test_done\n> \n> base-commit: 3e65291872de10c3f0bf05ea8c24187e7a71ebf0\n\n"}]}