git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Couder <chriscool@tuxfamily.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH] builtin-symbolic-ref: comment on the use of "resolve_ref" with reading == 0
Date: Sat, 6 Sep 2008 09:55:43 +0200	[thread overview]
Message-ID: <20080906095543.c627b692.chriscool@tuxfamily.org> (raw)

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

             reply	other threads:[~2008-09-06  7:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-06  7:55 Christian Couder [this message]
2008-09-06 10:08 ` [PATCH] builtin-symbolic-ref: comment on the use of "resolve_ref" with reading == 0 Junio C Hamano
2008-09-06 12:03   ` Christian Couder
2008-09-08  0:33     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080906095543.c627b692.chriscool@tuxfamily.org \
    --to=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).