Skip to content

Commit 52f2dfb

Browse files
KarthikNayakgitster
authored andcommitted
reflog: improve error for when reflog is not found
The 'git reflog expire' prints the error message '<ref> points nowhere!' when used with a non-existent ref. This message is a bit confusing and vague. Modify the message to be more clear and direct. Signed-off-by: Karthik Nayak <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a36e024 commit 52f2dfb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

builtin/reflog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix,
383383
struct expire_reflog_policy_cb cb = { .cmd = cmd };
384384

385385
if (!repo_dwim_log(the_repository, argv[i], strlen(argv[i]), NULL, &ref)) {
386-
status |= error(_("%s points nowhere!"), argv[i]);
386+
status |= error(_("reflog could not be found: '%s'"), argv[i]);
387387
continue;
388388
}
389389
set_reflog_expiry_param(&cb.cmd, ref);

t/t1410-reflog.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,9 @@ test_expect_success 'git reflog expire unknown reference' '
315315
test_config gc.reflogexpireunreachable never &&
316316
317317
test_must_fail git reflog expire main@{123} 2>stderr &&
318-
test_grep "points nowhere" stderr &&
318+
test_grep "error: reflog could not be found: ${SQ}main@{123}${SQ}" stderr &&
319319
test_must_fail git reflog expire does-not-exist 2>stderr &&
320-
test_grep "points nowhere" stderr
320+
test_grep "error: reflog could not be found: ${SQ}does-not-exist${SQ}" stderr
321321
'
322322

323323
test_expect_success 'checkout should not delete log for packed ref' '

0 commit comments

Comments
 (0)