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 <avarab@gmail.com> Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Han-Wen Nienhuys committed May 31, 2021 at 16:56 UTC 0221eb86782bdd2cbbe9d6223d7ac9bcb61961b1
1 file changed +1 -1
t/helper/test-ref-store.c
+1 -1
@@ -118,7 +118,7 @@ static int cmd_for_each_ref(struct ref_store *refs, const char **argv)
118
119 static int cmd_resolve_ref(struct ref_store *refs, const char **argv)
120 {
121 - struct object_id oid;
121 + struct object_id oid = *null_oid();
122 const char *refname = notnull(*argv++, "refname");
123 int resolve_flags = arg_flags(*argv++, "resolve-flags");
124 int flags;