From: Han-Wen Nienhuys Date: Mon, 31 May 2021 16:56:17 +0000 (+0000) Subject: t/helper/ref-store: initialize oid in resolve-ref X-Git-Tag: v2.33.0-rc0~67^2~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0221eb86782bdd2cbbe9d6223d7ac9bcb61961b1;p=thirdparty%2Fgit.git t/helper/ref-store: initialize oid in resolve-ref This will print $ZERO_OID when asking for a non-existent ref from the test-helper. Since resolve-ref provides direct access to refs_resolve_ref_unsafe(), it provides a reliable mechanism for accessing REFNAME, while avoiding the implicit resolution to refs/heads/REFNAME. Reviewed-by: Ævar Arnfjörð Bjarmason Signed-off-by: Han-Wen Nienhuys Signed-off-by: Junio C Hamano --- diff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c index bba5f841c6..b314b81a45 100644 --- a/t/helper/test-ref-store.c +++ b/t/helper/test-ref-store.c @@ -118,7 +118,7 @@ static int cmd_for_each_ref(struct ref_store *refs, const char **argv) static int cmd_resolve_ref(struct ref_store *refs, const char **argv) { - struct object_id oid; + struct object_id oid = *null_oid(); const char *refname = notnull(*argv++, "refname"); int resolve_flags = arg_flags(*argv++, "resolve-flags"); int flags;