[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git
Subject:    Re: [PATCH 2/2] builtin-reflog: fix deletion of HEAD entries
From:       Pieter de Bie <pdebie () ai ! rug ! nl>
Date:       2008-08-10 9:35:01
Message-ID: 1218360901-36215-1-git-send-email-pdebie () ai ! rug ! nl
[Download RAW message or body]

On Aug 10, 2008, at 3:01 AM, Junio C Hamano wrote:
>-		if (!dwim_ref(argv[i], spec - argv[i], sha1, &ref)) {
>+		if (!dwim_log(argv[i], spec - argv[i], sha1, &ref)) {

This is also what add_reflog_for_walk() does, but that function tries to resolve
the argv[i] part first, without doing the dwim_log().

Perhaps we can also do this to allow "git reflog expire master" instead of
"git reflog expire refs/heads/master"? 

--<8--
Subject: [PATCH] builtin-reflog: Allow reflog expire to name partial ref

This allows you to specify 'git reflog expire master' without needing
to give the full refname like 'git reflog expire refs/heads/master'

Signed-off-by: Pieter de Bie <pdebie@ai.rug.nl>
---
 builtin-reflog.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/builtin-reflog.c b/builtin-reflog.c
index 5af3f28..a8311a6 100644
--- a/builtin-reflog.c
+++ b/builtin-reflog.c
@@ -541,14 +541,15 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
 	}
 
 	while (i < argc) {
-		const char *ref = argv[i++];
+		char *ref;
 		unsigned char sha1[20];
-		if (!resolve_ref(ref, sha1, 1, NULL)) {
-			status |= error("%s points nowhere!", ref);
+		if (!dwim_log(argv[i], strlen(argv[i]), sha1, &ref)) {
+			status |= error("%s points nowhere!", argv[i]);
 			continue;
 		}
 		set_reflog_expiry_param(&cb, explicit_expiry, ref);
 		status |= expire_reflog(ref, sha1, 0, &cb);
+		i++;
 	}
 	return status;
 }
-- 
1.6.0.rc0.320.g49281

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic