git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] remote: pass NULL to read_ref_full() because object ID is not needed

From
René Scharfe <l.s.r@web.de>
Date
Dec 11, 2019, 18:46 UTC
Message-ID
<24fc1649-d80c-cc4b-8268-a7833812d39c@web.de>

read_ref_full() wraps refs_read_ref_full(), which in turn wraps refs_resolve_ref_unsafe(), which handles a NULL oid pointer of callers not interested in the resolved object ID. Make use of that feature to document that mv() is such a caller.

Signed-off-by: René Scharfe <l.s.r@web.de>
---
 builtin/remote.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/builtin/remote.c b/builtin/remote.c
index 5591cef775..96bbe828fe 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -693,9 +693,8 @@ static int mv(int argc, const char **argv)
 	for (i = 0; i < remote_branches.nr; i++) {
 		struct string_list_item *item = remote_branches.items + i;
 		int flag = 0;
-		struct object_id oid;

-		read_ref_full(item->string, RESOLVE_REF_READING, &oid, &flag);
+		read_ref_full(item->string, RESOLVE_REF_READING, NULL, &flag);
 		if (!(flag & REF_ISSYMREF))
 			continue;
 		if (delete_ref(NULL, item->string, NULL, REF_NO_DEREF))
--
2.24.1
Next: Derrick Stolee
Message 1 of 2 in “remote: pass NULL to read_ref_full() because object ID is not needed”
  1. remote: pass NULL to read_ref_full() because object ID is not neededRené Scharfe, Dec 11, 2019
  2. Derrick StoleeDec 11, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.