]> Kevux Git Server - rit/commit
fetch set_head: fix non-mirror remotes in bare repositories
authorBence Ferdinandy <bence@ferdinandy.com>
Sun, 26 Jan 2025 22:02:11 +0000 (23:02 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 Jan 2025 16:16:47 +0000 (08:16 -0800)
commit93dc16483a312b77c0b6533a6c2705d1df3e3687
treeb2e3d1793a7ea6b7bcdb31d867ca58ad0847a140
parent638060dcb95ed7ef3b2f6e6038ac12744d8ba238
fetch set_head: fix non-mirror remotes in bare repositories

In b1b713f722 (fetch set_head: handle mirrored bare repositories,
2024-11-22) it was implicitly assumed that all remotes will be mirrors
in a bare repository, thus fetching a non-mirrored remote could lead to
HEAD pointing to a non-existent reference. Make sure we only overwrite
HEAD if we are in a bare repository and fetching from a mirror.
Otherwise, proceed as normally, and create
refs/remotes/<nonmirrorremote>/HEAD instead.

Reported-by: Christian Hesse <list@eworm.de>
Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fetch.c
t/t5505-remote.sh
t/t5510-fetch.sh