commit 65ad15fa440d89e976ce1bd3bd02d5440e86d5d3 from: Thomas Adam date: Sat Jul 16 19:55:21 2022 UTC portable: lib/repository.c: fixup merge It seems as though a merge from some time ago had left some stale changes in place. This brings the two files between upstream and portable back in-line. Noticed by stsp@ commit - 23794ad3ee282e996bc24eeb04eb1364a2140632 commit + 65ad15fa440d89e976ce1bd3bd02d5440e86d5d3 blob - 03f07f0502bcb5b56cfa17c892cce593e261e917 blob + ee9093dbcc252384d25fdce40f0631a837c3cf52 --- lib/repository.c +++ lib/repository.c @@ -1834,12 +1834,10 @@ got_repo_match_object_id(struct got_object_id **id, ch return err; } - err = got_repo_match_object_id_prefix(id, id_str, obj_type, repo); - if (err) { - if (err->code != GOT_ERR_BAD_OBJ_ID_STR) - return err; - err = got_ref_open(&ref, repo, id_str, 0); - if (err != NULL) + err = got_ref_open(&ref, repo, id_str, 0); + if (err == NULL) { + err = got_ref_resolve(id, repo, ref); + if (err) goto done; if (label) { *label = strdup(got_ref_get_name(ref)); @@ -1848,13 +1846,24 @@ got_repo_match_object_id(struct got_object_id **id, ch goto done; } } - err = got_ref_resolve(id, repo, ref); - } else if (label) { - err = got_object_id_str(label, *id); - if (*label == NULL) { - err = got_error_from_errno("strdup"); + } else { + if (err->code != GOT_ERR_NOT_REF && + err->code != GOT_ERR_BAD_REF_NAME) goto done; + err = got_repo_match_object_id_prefix(id, id_str, + obj_type, repo); + if (err) { + if (err->code == GOT_ERR_BAD_OBJ_ID_STR) + err = got_error_not_ref(id_str); + goto done; } + if (label) { + err = got_object_id_str(label, *id); + if (*label == NULL) { + err = got_error_from_errno("strdup"); + goto done; + } + } } done: if (ref)