[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