From: Junio C Hamano Date: Fri, 31 Jul 2026 23:20:56 +0000 (-0700) Subject: Merge branch 'sn/rebase-update-refs-symrefs' into seen X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6b7c3780c7805eb329b0fd0cf02fb85d520f0e3a;p=thirdparty%2Fgit.git Merge branch 'sn/rebase-update-refs-symrefs' into seen '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 --- 6b7c3780c7805eb329b0fd0cf02fb85d520f0e3a diff --cc branch.c index 31056f7040,98a50d8368..83fa1034a7 --- a/branch.c +++ 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) { + char *resolved_ref; + int flags = 0; + - old = strmap_put(¤t_checked_out_branches, - item->string, - xstrdup(wt->path)); - free(old); + 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)) { - old = strmap_put( ++ char *old = strmap_put( + ¤t_checked_out_branches, + resolved_ref, xstrdup(wt->path)); + free(old); + } + free(resolved_ref); } string_list_clear(&update_refs, 1); }