# [PATCH]

2 messages from 2008-07-24 to 2008-07-24. Participants: Junio C Hamano.
Thread: https://gitlist.dev/t/14646

## Junio C Hamano, 2008-07-24 00:22

Subject: [PATCH]
Message-ID: <7vej5k8719.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vej5k8719.fsf%40gitster.siamese.dyndns.org

```
f2eba66 (Enable HEAD@{...} and make it independent from the current
branch, 2007-02-03) introduced dwim_log() to handle <refname>@{...}
syntax, and as part of its processing, it checks if the ref exists by
calling refsolve_ref().  It should call it as a reader to make sure the
call returns NULL for a nonexistent ref (not as a potential writer in
which case it does not return NULL).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * I found this purely by accident.  "echo >.git/logs/refs/heads/HEAD"
   would make your "git rev-parse HEAD@{1}" complain about a refname
   'HEAD' being ambiguous without this patch.

 sha1_name.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sha1_name.c b/sha1_name.c
index b0b2167..4fb77f8 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -273,7 +273,7 @@ int dwim_log(const char *str, int len, unsigned char *sha1, char **log)
 		const char *ref, *it;
 
 		strcpy(path, mkpath(*p, len, str));
-		ref = resolve_ref(path, hash, 0, NULL);
+		ref = resolve_ref(path, hash, 1, NULL);
 		if (!ref)
 			continue;
 		if (!stat(git_path("logs/%s", path), &st) &&

```

## Junio C Hamano, 2008-07-24 00:58

Subject: Re: [PATCH] (unnamed)
Message-ID: <7v63qw85dm.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v63qw85dm.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <7vej5k8719.fsf@gitster.siamese.dyndns.org>

```
Ooops.

I sent out before I can decide what the title should be.  Sorry, will
think of something.

```
