Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeng Long <dyroneteng@gmail.com>2023-05-29 16:27:56 +0300
committerJunio C Hamano <gitster@pobox.com>2023-06-03 03:01:10 +0300
commite4cf01346831ec8f2d4d2bd4d325d2f152259c49 (patch)
tree99911d9789bbf5d63279d590cc89123b69123dd8 /builtin/commit.c
parentfe86abd7511a9a6862d5706c6fa1d9b57a63ba09 (diff)
surround %s with quotes when failed to lookup commit
The output may become confusing to recognize if the user accidentally gave an extra opening space, like: $ git commit --fixup=" 6d6360b67e99c2fd82d64619c971fdede98ee74b" fatal: could not lookup commit 6d6360b67e99c2fd82d64619c971fdede98ee74b and it will be better if we surround the %s specifier with single quotes. Signed-off-by: Teng Long <dyroneteng@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit.c')
-rw-r--r--builtin/commit.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index e67c4be221..9ab57ea1aa 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -763,7 +763,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
struct commit *c;
c = lookup_commit_reference_by_name(squash_message);
if (!c)
- die(_("could not lookup commit %s"), squash_message);
+ die(_("could not lookup commit '%s'"), squash_message);
ctx.output_encoding = get_commit_output_encoding();
repo_format_commit_message(the_repository, c,
"squash! %s\n\n", &sb,
@@ -798,7 +798,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
char *fmt;
commit = lookup_commit_reference_by_name(fixup_commit);
if (!commit)
- die(_("could not lookup commit %s"), fixup_commit);
+ die(_("could not lookup commit '%s'"), fixup_commit);
ctx.output_encoding = get_commit_output_encoding();
fmt = xstrfmt("%s! %%s\n\n", fixup_prefix);
repo_format_commit_message(the_repository, commit, fmt, &sb,
@@ -1189,7 +1189,7 @@ static const char *read_commit_message(const char *name)
commit = lookup_commit_reference_by_name(name);
if (!commit)
- die(_("could not lookup commit %s"), name);
+ die(_("could not lookup commit '%s'"), name);
out_enc = get_commit_output_encoding();
return repo_logmsg_reencode(the_repository, commit, NULL, out_enc);
}