]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'sn/rebase-update-refs-symrefs' into seen
authorJunio C Hamano <gitster@pobox.com>
Thu, 30 Jul 2026 17:44:33 +0000 (10:44 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 30 Jul 2026 17:44:34 +0000 (10:44 -0700)
'git rebase --update-refs' has been taught to resolve local branch
symrefs to their referents before queuing updates, ensuring aliases of
the current branch are skipped and duplicate updates are avoided to
prevent failures when branch aliases are present.

* sn/rebase-update-refs-symrefs:
  rebase: guard non-branch symref targets
  rebase: skip branch symref aliases

1  2 
branch.c
sequencer.c
t/t3400-rebase.sh
t/t3404-rebase-interactive.sh

diff --cc branch.c
index 31056f7040b120667499abfc33eada3be236d6b8,98a50d836802017b5141a3e207248d690cc0adc4..83fa1034a7c8002c58122f51fb71d3179d00530f
+++ b/branch.c
@@@ -474,9 -442,25 +474,24 @@@ static void prepare_checked_out_branche
                                                     &update_refs)) {
                        struct string_list_item *item;
                        for_each_string_list_item(item, &update_refs) {
 -                              old = strmap_put(&current_checked_out_branches,
 -                                               item->string,
 -                                               xstrdup(wt->path));
 -                              free(old);
+                               char *resolved_ref;
+                               int flags = 0;
 -                                      old = strmap_put(
 +                              register_checked_out_branch("", item->string,
 +                                                          wt->path,
 +                                                          BRANCH_CHECKOUT_KIND_UPDATE_REF);
+                               resolved_ref = refs_resolve_refdup(
+                                       get_main_ref_store(the_repository),
+                                       item->string, RESOLVE_REF_READING,
+                                       NULL, &flags);
+                               if (resolved_ref && (flags & REF_ISSYMREF)) {
++                                      char *old = strmap_put(
+                                               &current_checked_out_branches,
+                                               resolved_ref, xstrdup(wt->path));
+                                       free(old);
+                               }
+                               free(resolved_ref);
                        }
                        string_list_clear(&update_refs, 1);
                }
diff --cc sequencer.c
Simple merge
Simple merge
Simple merge