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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Pieter de Bie committed
Aug 10, 2008 at 22:22 UTC
90fb46ec83cd837364592ce4d95055a3b6fe89a4
1 file changed
+4
-4
builtin-reflog.c
+4
-4
@@ -540,11 +540,11 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
540
free(collected.e);
541
}
542
543
- while (i < argc) {
544
- const char *ref = argv[i++];
543
+ for (; i < argc; i++) {
544
+ char *ref;
545
unsigned char sha1[20];
546
- if (!resolve_ref(ref, sha1, 1, NULL)) {
547
- status |= error("%s points nowhere!", ref);
546
+ if (!dwim_log(argv[i], strlen(argv[i]), sha1, &ref)) {
547
+ status |= error("%s points nowhere!", argv[i]);
548
continue;
549
}
550
set_reflog_expiry_param(&cb, explicit_expiry, ref);