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

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

From
PBPieter de Bie <pdebie@ai.rug.nl>
Date
Aug 10, 2008, 20:22 UTC
Message-ID
<1218399741-37049-1-git-send-email-pdebie@ai.rug.nl>
In-Reply-To
<9746FE5D-816C-4818-B32F-EE0028918F72@ai.rug.nl>

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 |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/builtin-reflog.c b/builtin-reflog.c
index 5af3f28..f4d1f32 100644
--- a/builtin-reflog.c
+++ b/builtin-reflog.c
@@ -540,11 +540,11 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
 		free(collected.e);
 	}
 
-	while (i < argc) {
-		const char *ref = argv[i++];
+	for (; i < argc; 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);
-- 
1.6.0.rc0.320.g49281
Previous: Pieter de Bie
Message 9 of 9 in “reflog test: add more tests for 'reflog delete'”
  1. 1/2 reflog test: add more tests for 'reflog delete'Pieter de Bie, Aug 9, 2008
  2. 2/2 builtin-reflog: fix deletion of HEAD entriesPieter de Bie, Aug 9, 2008
  3. Junio C HamanoAug 10, 2008
  4. Junio C HamanoAug 10, 2008
  5. Pieter de BieAug 10, 2008
  6. Johannes SixtAug 10, 2008
  7. Junio C HamanoAug 10, 2008
  8. Pieter de BieAug 10, 2008
  9. builtin-reflog: Allow reflog expire to name partial refPieter de Bie, Aug 10, 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.