Skip to contentSkip to conversation

Extra pair of double quotes in "git commit" output?

DISCUSSION Nanako Shiraishi 6 participants 7 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

While I think the way recent "git commit" displays the commit you just created is very helpful, I often find the double quotes around the message unnecessary and sometimes even confusing. I just made a commit and saw this message:

[master]: created d9a5491: "Show "standard deviation" column in table 3"

The colon after the shortened commit SHA1 is enough to signal that it will talk about a different piece of information on the rest of the line. I think the extra double quotes can be dropped safely:

[master]: created d9a5491: Show "standard deviation" column in table 3

and it will make the output shorter by two columns, more pretty, and does not lose the clarity.

Signature · 2 lines
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/
#1 lore raw
Quoted 6 lines · Nanako Shiraishi

While I think the way recent "git commit" displays the commit you just created is very helpful, I often find the double quotes around the message unnecessary and sometimes even confusing. I just made a commit and saw this message:

[master]: created d9a5491: "Show "standard deviation" column in table 3"

While I do think that typographically the embedded quotes look awful, I find that the quotes do help separate the commit subject from the other text when there are colons in the subject. IOW, I think that

[master]: created d9a5491: foo: bar

is harder to read than

[master]: created d9a5491: "foo: bar"

And 47% of commits in git.git have a colon (only 7% have a double quote).

So I sympathize with the desire to remove the quotes, as they look bad and are obviously not too rare. But I'd like to find a solution which maintains a better visual separation between the subject and the other text than simply removing them.

-Peff

#2 lore raw

On Wed, Nov 26, 2008 at 12:25 AM, Jeff King <[email protected]> wrote:

[...]

Quoted 5 lines

So I sympathize with the desire to remove the quotes, as they look bad and are obviously not too rare. But I'd like to find a solution which maintains a better visual separation between the subject and the other text than simply removing them.

Maybe just use the output of "git branch -v":

master d9a5491 foo: bar

or even literally:

* master d9a5491 [ahead 1] foo: bar

or to make the separation more evident:

[master d9a5491] foo: bar

Santi

#3 lore raw
Quoted 11 lines · Santi Béjar

Maybe just use the output of "git branch -v":

master d9a5491 foo: bar

or even literally:

* master d9a5491 [ahead 1] foo: bar

or to make the separation more evident:

[master d9a5491] foo: bar

Out of those suggestions, I find only the final one aesthetically acceptable. Nobody else has weighed in, so maybe they don't care. Or maybe they are just on vacation due to the (American) holiday.

-Peff

#4 lore raw
Quoted 7 lines · Jeff King
Quoted 3 lines

or to make the separation more evident:

[master d9a5491] foo: bar

Out of those suggestions, I find only the final one aesthetically acceptable. Nobody else has weighed in, so maybe they don't care. Or maybe they are just on vacation due to the (American) holiday.

Color certainly works well in the cases where that is available. Otherwise, I prefer the above solution.

David

#5 lore raw
In reply to Jeff King
Quoted 10 lines · Jeff King
Quoted 8 lines · Santi Béjar

Maybe just use the output of "git branch -v":

master d9a5491 foo: bar

or even literally:

* master d9a5491 [ahead 1] foo: bar

Quoted 7 lines
Quoted 3 lines

or to make the separation more evident:

[master d9a5491] foo: bar

Out of those suggestions, I find only the final one aesthetically acceptable. Nobody else has weighed in, so maybe they don't care. Or maybe they are just on vacation due to the (American) holiday.

+1 for the last one.

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
#6 lore raw
In reply to Nanako Shiraishi
Quoted 9 lines · Nanako Shiraishi

While I think the way recent "git commit" displays the commit you just created is very helpful, I often find the double quotes around the message unnecessary and sometimes even confusing. I just made a commit and saw this message:

[master]: created d9a5491: "Show "standard deviation" column in table 3"

The colon after the shortened commit SHA1 is enough to signal that it will talk about a different piece of information on the rest of the line. I think the extra double quotes can be dropped safely:

[master]: created d9a5491: Show "standard deviation" column in table 3

and it will make the output shorter by two columns, more pretty, and does not lose the clarity.

[offtopic. Please wrap your text at a reasonable width around 70 columns]

Like this?

It might break some existing tests (I didn't check), but I think that is a sensible thing to do.

 builtin-commit.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
builtin-commit.c +1 -1
index 591d16b..654bfbe 100644
@@ -881,7 +881,7 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
 {
 	struct rev_info rev;
 	struct commit *commit;
-	static const char *format = "format:%h: \"%s\"";
+	static const char *format = "format:%h: %s";
 	unsigned char junk_sha1[20];
 	const char *head = resolve_ref("HEAD", junk_sha1, 0, NULL);