[PATCH] Fixning WTF porcelain messages

DORMANTno replies

3 messages, 2 authors, 2016-06-15 · open the first message on its own page

[PATCH] Fixning WTF porcelain messages

From: Alexander Shopov <hidden>
Date: 2016-06-15 23:02:14

Some user-facing porcelain messages in Git are hard to understand and
hard to translate. They confuse users winthout providing proper
information and course of action. Here is the list of these messages
(starting with "-") and my suggestions (starting with "+"). The patch
follows in the next letter.

-Huh (%s)?
+Wrong choice (%s). Choose again.

-Clever... amending the last one with dirty index.
+You are amending the last commit only. There are additional changes in the index.

-confusion beyond insanity in parse_pack_objects()
+fatal error in function "parse_pack_objects". This is a bug in Git. Please report it to the developers with an e-mail to git@vger.kernel.org.

-confusion beyond insanity
+fatal error in function "conclude_pack". This is a bug in Git. Please report it to the developers with an e-mail to git@vger.kernel.org.

-insane in-reply-to: %s
+wrong format for the "in-reply-to" header: %s

-Two output directories?
+Maximum one output directory is allowed.

-Wonderful.\n
+The first part of the trivial merge finished successfully.\n

-Nope.\n
+Merge was not successful.\n

- ???
+ unknown state

-no tag message?
+missing tag message

-?? what are you talking about?
+unknown command. Only "start", "good", "bad" and "skip" are possible.

-Unprocessed path??? %s
+The path "%s" was not processed but it had to be. This is a bug in Git. Please report it to the developers with an e-mail to git@vger.kernel.org.



Alexander Shopov (1):
  Fixing unclear messages

 builtin/clean.c      | 2 +-
 builtin/commit.c     | 2 +-
 builtin/index-pack.c | 4 ++--
 builtin/log.c        | 4 ++--
 builtin/merge.c      | 5 +++--
 builtin/remote.c     | 2 +-
 builtin/tag.c        | 2 +-
 git-bisect.sh        | 2 +-
 merge-recursive.c    | 2 +-
 9 files changed, 13 insertions(+), 12 deletions(-)

-- 
1.9.3

[PATCH] Fixing unclear messages

From: Alexander Shopov <hidden>
Date: 2016-06-15 23:02:14

Signed-off-by: Alexander Shopov <redacted>
---
 builtin/clean.c      | 2 +-
 builtin/commit.c     | 2 +-
 builtin/index-pack.c | 4 ++--
 builtin/log.c        | 4 ++--
 builtin/merge.c      | 5 +++--
 builtin/remote.c     | 2 +-
 builtin/tag.c        | 2 +-
 git-bisect.sh        | 2 +-
 merge-recursive.c    | 2 +-
 9 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/builtin/clean.c b/builtin/clean.c
index 1032563..9f38068 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -514,7 +514,7 @@ static int parse_choice(struct menu_stuff *menu_stuff,
 		if (top <= 0 || bottom <= 0 || top > menu_stuff->nr || bottom > top ||
 		    (is_single && bottom != top)) {
 			clean_print_color(CLEAN_COLOR_ERROR);
-			printf_ln(_("Huh (%s)?"), (*ptr)->buf);
+			printf_ln(_("Wrong choice (%s). Choose again."), (*ptr)->buf);
 			clean_print_color(CLEAN_COLOR_RESET);
 			continue;
 		}
diff --git a/builtin/commit.c b/builtin/commit.c
index 5ed6036..cdc8a4e 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1198,7 +1198,7 @@ static int parse_and_validate_options(int argc, const char *argv[],
 	if (argc == 0 && (also || (only && !amend)))
 		die(_("No paths with --include/--only does not make sense."));
 	if (argc == 0 && only && amend)
-		only_include_assumed = _("Clever... amending the last one with dirty index.");
+		only_include_assumed = _("You are amending the last commit only. There are additional changes in the index.");
 	if (argc > 0 && !also && !only)
 		only_include_assumed = _("Explicit paths specified without -i or -o; assuming --only paths...");
 	if (!cleanup_arg || !strcmp(cleanup_arg, "default"))
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 5568a5b..d9c5911 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -1064,7 +1064,7 @@ static void parse_pack_objects(unsigned char *sha1)
 		nr_delays--;
 	}
 	if (nr_delays)
-		die(_("confusion beyond insanity in parse_pack_objects()"));
+		die(_("fatal error in function \"parse_pack_objects\". This is a bug in Git. Please report it to the developers with an e-mail to git@vger.kernel.org."));
 }
 
 /*
@@ -1139,7 +1139,7 @@ static void conclude_pack(int fix_thin_pack, const char *curr_pack, unsigned cha
 		int nr_unresolved = nr_deltas - nr_resolved_deltas;
 		int nr_objects_initial = nr_objects;
 		if (nr_unresolved <= 0)
-			die(_("confusion beyond insanity"));
+			die(_("fatal error in function \"conclude_pack\". This is a bug in Git. Please report it to the developers with an e-mail to git@vger.kernel.org."));
 		objects = xrealloc(objects,
 				   (nr_objects + nr_unresolved + 1)
 				   * sizeof(*objects));
diff --git a/builtin/log.c b/builtin/log.c
index 4389722..d614a20 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -992,7 +992,7 @@ static const char *clean_message_id(const char *msg_id)
 		m++;
 	}
 	if (!z)
-		die(_("insane in-reply-to: %s"), msg_id);
+		die(_("wrong format for the \"in-reply-to\" header: %s"), msg_id);
 	if (++z == m)
 		return a;
 	return xmemdupz(a, z - a);
@@ -1065,7 +1065,7 @@ static int output_directory_callback(const struct option *opt, const char *arg,
 {
 	const char **dir = (const char **)opt->value;
 	if (*dir)
-		die(_("Two output directories?"));
+		die(_("Maximum one output directory is allowed."));
 	*dir = arg;
 	return 0;
 }
diff --git a/builtin/merge.c b/builtin/merge.c
index ce82eb2..e92a74a 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -842,7 +842,8 @@ static int merge_trivial(struct commit *head, struct commit_list *remoteheads)
 	struct commit_list *parents, **pptr = &parents;
 
 	write_tree_trivial(result_tree);
-	printf(_("Wonderful.\n"));
+	printf(_("The first part of the trivial merge finished successfully
+.\n"));
 	pptr = commit_list_append(head, pptr);
 	pptr = commit_list_append(remoteheads->item, pptr);
 	prepare_to_commit(remoteheads);
@@ -1400,7 +1401,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 				ret = merge_trivial(head_commit, remoteheads);
 				goto done;
 			}
-			printf(_("Nope.\n"));
+			printf(_("Merge was not successful.\n"));
 		}
 	} else {
 		/*
diff --git a/builtin/remote.c b/builtin/remote.c
index 9a4640d..3f480b1 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -951,7 +951,7 @@ static int show_remote_info_item(struct string_list_item *item, void *cb_data)
 		else if (string_list_has_string(&states->stale, name))
 			arg = _(" stale (use 'git remote prune' to remove)");
 		else
-			arg = _(" ???");
+			arg = _(" unknown state");
 		printf("    %-*s", info->width, name);
 		printf(fmt, arg);
 		printf("\n");
diff --git a/builtin/tag.c b/builtin/tag.c
index 19eb747..8a565fc 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -501,7 +501,7 @@ static void create_tag(const unsigned char *object, const char *tag,
 		stripspace(buf, opt->cleanup_mode == CLEANUP_ALL);
 
 	if (!opt->message_given && !buf->len)
-		die(_("no tag message?"));
+		die(_("missing tag message"));
 
 	strbuf_insert(buf, 0, header_buf, header_len);
 
diff --git a/git-bisect.sh b/git-bisect.sh
index 1e0d602..c7fb095 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -421,7 +421,7 @@ bisect_replay () {
 		good|bad|skip)
 			bisect_write "$command" "$rev" ;;
 		*)
-			die "$(gettext "?? what are you talking about?")" ;;
+			die "$(gettext "unknown command. Only \"start\", \"good\", \"bad\" and \"skip\" are possible.")" ;;
 		esac
 	done <"$file"
 	bisect_auto_next
diff --git a/merge-recursive.c b/merge-recursive.c
index 1d332b8..bb71cb6 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1858,7 +1858,7 @@ int merge_trees(struct merge_options *o,
 		for (i = 0; i < entries->nr; i++) {
 			struct stage_data *e = entries->items[i].util;
 			if (!e->processed)
-				die(_("Unprocessed path??? %s"),
+				die(_("The path \"%s\" was not processed but it had to be. This is a bug in Git. Please report it to the developers with an e-mail to git@vger.kernel.org."),
 				    entries->items[i].string);
 		}
 
-- 
1.9.3

Re: [PATCH] Fixing unclear messages

From: Jeff King <hidden>
Date: 2016-06-15 23:02:14

On Sun, Aug 10, 2014 at 06:13:27PM +0300, Alexander Shopov wrote:
Signed-off-by: Alexander Shopov <redacted>
It would probably make sense to put the discussion from your cover
letter into the commit message.
quoted hunk
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 5568a5b..d9c5911 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -1064,7 +1064,7 @@ static void parse_pack_objects(unsigned char *sha1)
 		nr_delays--;
 	}
 	if (nr_delays)
-		die(_("confusion beyond insanity in parse_pack_objects()"));
+		die(_("fatal error in function \"parse_pack_objects\". This is a bug in Git. Please report it to the developers with an e-mail to git@vger.kernel.org."));
 }
We usually just say:

  die("BUG: ...");

here (and hopefully the "..." actually describes the situation a bit
better). I have wondered if we should actually introduce a

  BUG("...");

function. Then it would make it simple to be more verbose (e.g.,
pointing the user to the mailing list as you do here) without having to
repeat the text in each place.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help