git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] error_resolve_conflict: rewrap advice message
@ 2014-06-03  7:17 Jeff King
  2014-06-03  7:23 ` [PATCH] error_resolve_conflict: drop quotations around operation Jeff King
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff King @ 2014-06-03  7:17 UTC (permalink / raw)
  To: git

If you try to commit with unresolved conflicts in the index,
you get this message:

	$ git commit
	U       foo
	error: 'commit' is not possible because you have unmerged files.
	hint: Fix them up in the work tree,
	hint: and then use 'git add/rm <file>' as
	hint: appropriate to mark resolution and make a commit,
	hint: or use 'git commit -a'.
	fatal: Exiting because of an unresolved conflict.

The irregular line-wrapping makes this awkward to read, and
it takes up more lines than necessary. Instead, let's rewrap
it to about 60 characters per line:

	$ git commit
	U       foo
	error: 'commit' is not possible because you have unmerged files.
	hint: Fix them up in the work tree, and then use 'git add/rm <file>'
	hint: as appropriate to mark resolution and make a commit, or use
	hint: 'git commit -a'.
	fatal: Exiting because of an unresolved conflict.

Signed-off-by: Jeff King <peff@peff.net>
---
This always bugs me when I see it, so I thought I'd finally do something
about it. I left the wording alone, though I'd also be happy to see it
shortened to just advise "git add/rm" and not mention "git commit -a" at
all.

 advice.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/advice.c b/advice.c
index 486f823..ef24733 100644
--- a/advice.c
+++ b/advice.c
@@ -82,10 +82,9 @@ int error_resolve_conflict(const char *me)
 		 * Message used both when 'git commit' fails and when
 		 * other commands doing a merge do.
 		 */
-		advise(_("Fix them up in the work tree,\n"
-			 "and then use 'git add/rm <file>' as\n"
-			 "appropriate to mark resolution and make a commit,\n"
-			 "or use 'git commit -a'."));
+		advise(_("Fix them up in the work tree, and then use 'git add/rm <file>'\n"
+			 "as appropriate to mark resolution and make a commit, or use\n"
+			 "'git commit -a'."));
 	return -1;
 }
 
-- 
2.0.0.rc1.436.g03cb729

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] error_resolve_conflict: drop quotations around operation
  2014-06-03  7:17 [PATCH] error_resolve_conflict: rewrap advice message Jeff King
@ 2014-06-03  7:23 ` Jeff King
  2014-06-03 17:02   ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff King @ 2014-06-03  7:23 UTC (permalink / raw)
  To: git

When you try to commit with unmerged entries, you get an
error like:

  $ git commit
  error: 'commit' is not possible because you have unmerged files.

The quotes around "commit" are clunky; the user doesn't care
that this message is a template with the command-name filled
in.  Saying:

  error: commit is not possible because you have unmerged files

is easier to read. As this code is called from other places,
we may also end up with:

  $ git merge
  error: merge is not possible because you have unmerged files

  $ git cherry-pick foo
  error: cherry-pick is not possible because you have unmerged files

  $ git revert foo
  error: revert is not possible because you have unmerged files

All of which look better without the quotes. This also
happens to match the behavior of "git pull", which generates
a similar message (but does not share code, as it is a shell
script).

Signed-off-by: Jeff King <peff@peff.net>
---
I realize this may just be a matter of taste, but I thought I'd put it
forth as a possibility.

I also considered switching the wording to:

  error: cannot commit because you have unmerged files

which I find a little more natural.

 advice.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/advice.c b/advice.c
index ef24733..c50ebdf 100644
--- a/advice.c
+++ b/advice.c
@@ -76,7 +76,7 @@ int git_default_advice_config(const char *var, const char *value)
 
 int error_resolve_conflict(const char *me)
 {
-	error("'%s' is not possible because you have unmerged files.", me);
+	error("%s is not possible because you have unmerged files.", me);
 	if (advice_resolve_conflict)
 		/*
 		 * Message used both when 'git commit' fails and when
-- 
2.0.0.rc1.436.g03cb729

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] error_resolve_conflict: drop quotations around operation
  2014-06-03  7:23 ` [PATCH] error_resolve_conflict: drop quotations around operation Jeff King
@ 2014-06-03 17:02   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2014-06-03 17:02 UTC (permalink / raw)
  To: Jeff King; +Cc: git

Jeff King <peff@peff.net> writes:

> When you try to commit with unmerged entries, you get an
> error like:
>
>   $ git commit
>   error: 'commit' is not possible because you have unmerged files.
>
> The quotes around "commit" are clunky; the user doesn't care
> that this message is a template with the command-name filled
> in.  Saying:
>
>   error: commit is not possible because you have unmerged files
>
> is easier to read. As this code is called from other places,
> we may also end up with:
>
>   $ git merge
>   error: merge is not possible because you have unmerged files
>
>   $ git cherry-pick foo
>   error: cherry-pick is not possible because you have unmerged files
>
>   $ git revert foo
>   error: revert is not possible because you have unmerged files
>
> All of which look better without the quotes. This also
> happens to match the behavior of "git pull", which generates
> a similar message (but does not share code, as it is a shell
> script).
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> I realize this may just be a matter of taste, but I thought I'd put it
> forth as a possibility.

If the template were filled with 'git commit', 'git merge', etc.,
then the quotes around %s may make it clearer, but 'me' here is
designed to be a single subcommand name, so this change is good.

> I also considered switching the wording to:
>
>   error: cannot commit because you have unmerged files
>
> which I find a little more natural.

Perhaps.  As long as the subcommand name that can come here as 'me'
is always a verb, that would work (I didn't think about l10n, tho).

>  advice.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/advice.c b/advice.c
> index ef24733..c50ebdf 100644
> --- a/advice.c
> +++ b/advice.c
> @@ -76,7 +76,7 @@ int git_default_advice_config(const char *var, const char *value)
>  
>  int error_resolve_conflict(const char *me)
>  {
> -	error("'%s' is not possible because you have unmerged files.", me);
> +	error("%s is not possible because you have unmerged files.", me);
>  	if (advice_resolve_conflict)
>  		/*
>  		 * Message used both when 'git commit' fails and when

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-03 17:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-03  7:17 [PATCH] error_resolve_conflict: rewrap advice message Jeff King
2014-06-03  7:23 ` [PATCH] error_resolve_conflict: drop quotations around operation Jeff King
2014-06-03 17:02   ` Junio C Hamano

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).