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

[PATCH] builtin-symbolic-ref: comment on the use of "resolve_ref" with reading == 0

From
Christian Couder <chriscool@tuxfamily.org>
Date
Sep 6, 2008, 07:55 UTC
Message-ID
<20080906095543.c627b692.chriscool@tuxfamily.org>
The following thread:
http://thread.gmane.org/gmane.comp.version-control.git/42469
(the message ID from the first message is:
20070318020645.2444.75365.julian@quantumfyre.co.uk)

explains why "resolve_ref" is used with a "reading" parameter set to 0 instead of 1, but there was no comment saying that near the code.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 builtin-symbolic-ref.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
	This comment may save other people some time.
diff --git a/builtin-symbolic-ref.c b/builtin-symbolic-ref.c
index bfc78bb..9490c47 100644
--- a/builtin-symbolic-ref.c
+++ b/builtin-symbolic-ref.c
@@ -12,6 +12,16 @@ static void check_symref(const char *HEAD, int quiet)
 {
 	unsigned char sha1[20];
 	int flag;
+
+	/*
+	 * It doesn't seem logical to use "resolve_ref" with reading == 0
+	 * as we are just checking if a ref exists, but some code depends
+	 * on the following to work:
+	 *
+	 *    $ git init-db
+	 *    $ git symbolic-ref HEAD
+	 *    refs/heads/master
+	 */
 	const char *refs_heads_master = resolve_ref(HEAD, sha1, 0, &flag);
 
 	if (!refs_heads_master)
-- 
1.6.0.1.338.g5e95.dirty
Next: Junio C Hamano
Message 1 of 4 in “builtin-symbolic-ref: comment on the use of "resolve_ref" with reading == 0”
  1. builtin-symbolic-ref: comment on the use of "resolve_ref" with reading == 0Christian Couder, Sep 6, 2008
  2. Junio C HamanoSep 6, 2008
  3. Christian CouderSep 6, 2008
  4. Junio C HamanoSep 8, 2008

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.