Subject: Re: [PATCH] rebase: ignore non-branch update-refs

From: Phillip Wood <[email-masked]>
Date: Sun, 10 May 2026 14:37:21 +0100

On 10/05/2026 02:11, Junio C Hamano wrote:
> [email-masked] writes:
> 
>> diff --git a/sequencer.c b/sequencer.c
>> index b7d8dca47f..25bcfc5da0 100644
>> --- a/sequencer.c
>> +++ b/sequencer.c
>> @@ -6428,6 +6428,16 @@ static int add_decorations_to_list(const struct commit *commit,
>>   		const char *path;
>>   		size_t base_offset = ctx->buf->len;
>>   
>> +		/*
>> +		 * The global decoration table may contain names loaded by
>> +		 * a previous pretty format such as "%d".
>> +		 * This will result in refs such as "HEAD" being present.
>> +		 */
> 
> Your long topic branch may have local unannotated tags that point
> into the middle of it, marking strategic points in the topic.
> 
> With this change, the command no longer moves them when it rebases
> the entire topic.  Isn't it a regression?

sequencer.c:todo_list_add_update_ref_commands() calls 
load_branch_decorations() so it does not update tags and the patch is 
correct.

Looking at make_script_with_merges() it also calls 
load_branch_decorations() so we should probably add something like the 
diff below. Having said that this patch is a strict improvement so we 
can always fix make_script_with_merges() as a follow up.

Thanks

Phillip

---- 8< ----

diff --git b/sequencer.c b/sequencer.c
--- a/sequencer.c
+++ b/sequencer.c
@@ -5982,6 +5982,15 @@ static int make_script_with_merges(struct 
pretty_print_context *pp,
  			const char *label = label_from_message.buf;
  			const struct name_decoration *decoration =
  				get_name_decoration(&to_merge->item->object);
+
+			/*
+			 * If rebase.instructionFormat includes "%d"
+			 * then we to skip non-local decorations as
+			 * we're only interested in branch names
+			 */
+			while (decoration &&
+			       decoration->type != DECORATION_REF_LOCAL)
+				decoration = decoration->next;

  			if (decoration)
  				skip_prefix(decoration->name, "refs/heads/",