From: Phillip Wood Date: Thu, 07 May 2026 16:08:24 GMT Subject: Re: [PATCH] rebase: ignore non-branch update-refs Message-ID: In-Reply-To: <20260506023944.90691-1-mail@abhinavg.net> Hi Abhinav On 06/05/2026 03:39, mail@abhinavg.net wrote: > From: Abhinav Gupta > > The following Git configuration breaks git rebase --update-refs: > > [rebase] > instructionFormat = %s%d > > The '%d' format requests all available decorations for a commit, > filling the global decoration table with all of them, > which --update-refs then uses to populate 'update-ref' instructions > in the rebase todo list. > > Specifically, this results in the following instruction: > > update-ref HEAD > > The todo parser then rejects the instruction: > > error: update-ref requires a fully qualified refname e.g. refs/heads/HEAD > error: invalid line 3: update-ref HEAD > > To fix, ignore decorations that are not local branches > when scanning through the table. Thanks for the clear explanation, the solution makes sense > diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh > index 3e44562afa..d58236f0eb 100755 > --- a/t/t3404-rebase-interactive.sh > +++ b/t/t3404-rebase-interactive.sh > @@ -1960,6 +1960,28 @@ test_expect_success '--update-refs adds commands with --rebase-merges' ' > ) > ' > > +test_expect_success '--update-refs ignores non-branch decorations' ' > + test_when_finished "git branch -D update-refs" && > + test_when_finished "git branch -D third" && I'm not sure that we really need to create this branch in the first place. We already create update-refs from no-conflict-branch so we can check that no-conflict-branch appears and update-refs does not. In addition to checking that HEAD does not appear we should also check that we don't try to update any tags (HEAD matches tag M). I think the simplest way is to check the output of "grep ^update-ref todo" so we'd have test_expect_success '--update-refs ignores non-branch decorations' ' test_when_finished "git branch -D update-refs" && test_when_finished "git checkout primary" && git checkout -B update-refs no-conflict-branch && ( set_cat_todo_editor && # rebase.instructionFormat=%d loads normal log decorations before # --update-refs adds its branch placeholders so we must ignore # all non-local decorations. test_must_fail git -c rebase.instructionFormat="%s%d" \ rebase -i --update-refs HEAD^ >todo ) && grep ^update-ref todo >actual && test_write_lines "update-ref refs/heads/no-conflict-branch" >expect && test_cmp expect actual ' Thanks for working on this Phillip > + test_when_finished "git checkout primary" && > + git checkout -B update-refs no-conflict-branch && > + git branch -f third HEAD~1 && > + ( > + set_cat_todo_editor && > + > + # rebase.instructionFormat=%d loads normal log decorations before > + # --update-refs adds its branch placeholders. > + # The placeholder scan must still ignore symbolic decorations, > + # because "update-ref HEAD" is not a valid branch update. > + test_must_fail git -c rebase.instructionFormat="%s%d" \ > + rebase -i --update-refs primary >todo && > + > + test_grep "^update-ref refs/heads/third$" todo && > + test_grep ! "^update-ref refs/heads/update-refs$" todo && > + test_grep ! "^update-ref HEAD$" todo > + ) > +' > + > test_expect_success '--update-refs updates refs correctly' ' > git checkout -B update-refs no-conflict-branch && > git branch -f base HEAD~4 && > > base-commit: 94f057755b7941b321fd11fec1b2e3ca5313a4e0