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

[PATCH 4/3] refs: pass NULL to refs_resolve_refdup() if hash is not needed

From
René Scharfe <l.s.r@web.de>
Date
Oct 1, 2017, 07:28 UTC
Message-ID
<366c778c-b587-de62-1d19-145d46fb1989@web.de>
In-Reply-To
<b89d36b5-0996-829b-a267-7ee4da9673dc@web.de>
This gets us rid of a write-only variable.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
 refs/files-backend.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/refs/files-backend.c b/refs/files-backend.c
index fec77744b4..ed00ddab1a 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -2499,7 +2499,6 @@ static int files_transaction_prepare(struct ref_store *ref_store,
 	struct string_list affected_refnames = STRING_LIST_INIT_NODUP;
 	char *head_ref = NULL;
 	int head_type;
-	struct object_id head_oid;
 	struct files_transaction_backend_data *backend_data;
 	struct ref_transaction *packed_transaction = NULL;
 
@@ -2556,7 +2555,7 @@ static int files_transaction_prepare(struct ref_store *ref_store,
 	 */
 	head_ref = refs_resolve_refdup(ref_store, "HEAD",
 				       RESOLVE_REF_NO_RECURSE,
-				       head_oid.hash, &head_type);
+				       NULL, &head_type);
 
 	if (head_ref && !(head_type & REF_ISSYMREF)) {
 		FREE_AND_NULL(head_ref);
-- 
2.14.2
Previous: René ScharfeNext: René Scharfe
Message 6 of 8 in “refs: make sha1 output parameter of refs_resolve_ref_unsafe() optional”
  1. 1/3 refs: make sha1 output parameter of refs_resolve_ref_unsafe() optionalRené Scharfe, Sep 23, 2017
  2. 2/3 refs: pass NULL to refs_resolve_ref_unsafe() if hash is not neededRené Scharfe, Sep 23, 2017
  3. 3/3 refs: pass NULL to resolve_ref_unsafe() if hash is not neededRené Scharfe, Sep 23, 2017
  4. Junio C HamanoSep 24, 2017
  5. René ScharfeSep 24, 2017
  6. 4/3 refs: pass NULL to refs_resolve_refdup() if hash is not neededRené Scharfe, Oct 1, 2017
  7. 5/3 refs: pass NULL to resolve_refdup() if hash is not neededRené Scharfe, Oct 1, 2017
  8. Junio C HamanoOct 1, 2017

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.