@matheusbsbs / matheus-bagliano / commits / e0ae2447d6
Fork 0

refs: pass NULL to refs_read_ref_full() because object ID is not needed

refs_read_ref_full() wraps refs_resolve_ref_unsafe(), which handles a NULL oid pointer of callers not interested in the resolved object ID. Pass NULL from files_copy_or_rename_ref() to clarify that it is one such caller. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Dec 11, 2019 at 19:46 UTC e0ae2447d66aa3983837ddc3d6fc0c3371a8e350
1 file changed +2 -2
refs/files-backend.c
+2 -2
@@ -1327,7 +1327,7 @@ static int files_copy_or_rename_ref(struct ref_store *ref_store,
1327 {
1328 struct files_ref_store *refs =
1329 files_downcast(ref_store, REF_STORE_WRITE, "rename_ref");
1330 - struct object_id oid, orig_oid;
1330 + struct object_id orig_oid;
1331 int flag = 0, logmoved = 0;
1332 struct ref_lock *lock;
1333 struct stat loginfo;
@@ -1395,7 +1395,7 @@ static int files_copy_or_rename_ref(struct ref_store *ref_store,
1395 */
1396 if (!copy && !refs_read_ref_full(&refs->base, newrefname,
1397 RESOLVE_REF_READING | RESOLVE_REF_NO_RECURSE,
1398 - &oid, NULL) &&
1398 + NULL, NULL) &&
1399 refs_delete_ref(&refs->base, NULL, newrefname,
1400 NULL, REF_NO_DEREF)) {
1401 if (errno == EISDIR) {