&update_refs)) {
struct string_list_item *item;
for_each_string_list_item(item, &update_refs) {
- old = strmap_put(¤t_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(
+ ¤t_checked_out_branches,
+ resolved_ref, xstrdup(wt->path));
+ free(old);
+ }
+ free(resolved_ref);
}
string_list_clear(&update_refs, 1);
}