commit ec9e97005c78048a84eebd1889f6d149c337ac8e from: Stefan Sperling date: Sat Jul 12 09:28:42 2025 UTC only pick a non-symbolic HEAD reference as the default branch to fetch commit - 55ff12a650e3bd5e4a81811caf98904a627c59e3 commit + ec9e97005c78048a84eebd1889f6d149c337ac8e blob - 78332997dbcd1bbcf19dda1a4540702bf27094d6 blob + da9cdaf407efe99157bcb838eb9d52d7b9de8ae9 --- libexec/got-fetch-pack/got-fetch-pack.c +++ libexec/got-fetch-pack/got-fetch-pack.c @@ -435,14 +435,6 @@ fetch_pack(int fd, int packfd, uint8_t *pack_sha1, continue; default_branch = symref_target; break; - } - if (default_branch == NULL) { - default_id_str = strdup(id_str); - if (default_id_str == NULL) { - err = got_error_from_errno( - "strdup"); - goto done; - } } } if (default_branch) @@ -454,6 +446,14 @@ fetch_pack(int fd, int packfd, uint8_t *pack_sha1, getprogname(), refname); } continue; + } + if (default_branch == NULL && + strcmp(refname, GOT_REF_HEAD) == 0) { + default_id_str = strdup(id_str); + if (default_id_str == NULL) { + err = got_error_from_errno("strdup"); + goto done; + } } if (default_branch && default_id_str == NULL && strcmp(refname, default_branch) == 0) {