git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Karthik Nayak <karthik.188@gmail.com>
To: git@vger.kernel.org
Cc: ps@pks.im, kristofferhaugsbakk@fastmail.com, gitster@pobox.com,
	 Karthik Nayak <karthik.188@gmail.com>
Subject: [PATCH v3 1/2] reflog: improve error for when reflog is not found
Date: Fri, 14 Mar 2025 09:40:34 +0100	[thread overview]
Message-ID: <20250314-493-add-command-to-purge-reflog-entries-v3-1-c24e23a6146d@gmail.com> (raw)
In-Reply-To: <20250314-493-add-command-to-purge-reflog-entries-v3-0-c24e23a6146d@gmail.com>

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 <karthik.188@gmail.com>
---
 builtin/reflog.c  | 2 +-
 t/t1410-reflog.sh | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/builtin/reflog.c b/builtin/reflog.c
index 95f264989b..762719315e 100644
--- a/builtin/reflog.c
+++ b/builtin/reflog.c
@@ -383,7 +383,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix,
 		struct expire_reflog_policy_cb cb = { .cmd = cmd };
 
 		if (!repo_dwim_log(the_repository, argv[i], strlen(argv[i]), NULL, &ref)) {
-			status |= error(_("%s points nowhere!"), argv[i]);
+			status |= error(_("reflog could not be found: '%s'"), argv[i]);
 			continue;
 		}
 		set_reflog_expiry_param(&cb.cmd, ref);
diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh
index 388fdf9ae5..1f7249be76 100755
--- a/t/t1410-reflog.sh
+++ b/t/t1410-reflog.sh
@@ -315,9 +315,9 @@ test_expect_success 'git reflog expire unknown reference' '
 	test_config gc.reflogexpireunreachable never &&
 
 	test_must_fail git reflog expire main@{123} 2>stderr &&
-	test_grep "points nowhere" stderr &&
+	test_grep "error: reflog could not be found: ${SQ}main@{123}${SQ}" stderr &&
 	test_must_fail git reflog expire does-not-exist 2>stderr &&
-	test_grep "points nowhere" stderr
+	test_grep "error: reflog could not be found: ${SQ}does-not-exist${SQ}" stderr
 '
 
 test_expect_success 'checkout should not delete log for packed ref' '

-- 
2.48.1


  reply	other threads:[~2025-03-14  8:40 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-07 11:17 [PATCH 0/2] EDITME: cover title for 493-add-command-to-purge-reflog-entries Karthik Nayak
2025-03-07 11:17 ` [PATCH 1/2] reflog: drop usage of global variables Karthik Nayak
2025-03-07 21:19   ` Junio C Hamano
2025-03-10 11:41     ` Karthik Nayak
2025-03-10 15:24       ` Junio C Hamano
2025-03-13 13:30         ` Karthik Nayak
2025-03-07 11:17 ` [PATCH 2/2] reflog: implement subcommand to drop reflogs Karthik Nayak
2025-03-07 11:50   ` Patrick Steinhardt
2025-03-07 12:53     ` Karthik Nayak
2025-03-07 12:59       ` Patrick Steinhardt
2025-03-07 13:28         ` Karthik Nayak
2025-03-07 13:28         ` Karthik Nayak
2025-03-07 21:28     ` Junio C Hamano
2025-03-10 11:28       ` Karthik Nayak
2025-03-10  7:39 ` [PATCH 0/2] EDITME: cover title for 493-add-command-to-purge-reflog-entries Kristoffer Haugsbakk
2025-03-10 12:34   ` Karthik Nayak
2025-03-10 15:28   ` Junio C Hamano
2025-03-10 12:36 ` [PATCH v2] reflog: implement subcommand to drop reflogs Karthik Nayak
2025-03-12  7:15   ` Patrick Steinhardt
2025-03-13 14:24     ` Karthik Nayak
2025-03-13 14:45       ` Patrick Steinhardt
2025-03-14  8:40 ` [PATCH v3 0/2] " Karthik Nayak
2025-03-14  8:40   ` Karthik Nayak [this message]
2025-03-14  8:40   ` [PATCH v3 2/2] " Karthik Nayak
2025-03-18 14:01     ` Christian Couder
2025-03-18 17:44       ` Junio C Hamano
2025-03-19  8:17         ` Christian Couder
2025-03-19  9:06           ` Karthik Nayak
2025-03-18 15:56     ` Toon Claes
2025-03-19  9:16       ` Karthik Nayak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250314-493-add-command-to-purge-reflog-entries-v3-1-c24e23a6146d@gmail.com \
    --to=karthik.188@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=kristofferhaugsbakk@fastmail.com \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).