News for hackers. Stuff that matters.
Re:Linus: please write good git commit messages by timknauf on Sunday November 27, 2011 @01:18PM (#3282949)
I'm curious about this:

please do proper word-wrap and keep columns shorter than about 74 characters or so

How come word-wrapping is left as a task for humans here? Is there a technical/stylistic/cultural reason why lines can't be wrapped automatically to any desired width by the log presentation layer?

Re:Linus: please write good git commit messages by JoshTriplett on Sunday November 27, 2011 @10:45PM (#3284398)
Because doing so would then require extra complexity to provide a syntax for lines that should not get wrapped, such as code, transcripts, tables, ASCII art...

Hard-wrapping paragraphs to a desired length in the original log allows humans to decide which lines should wrap and which ones shouldn't, without a pile of complexity similar to HTML, Markdown, or some other markup language.

Re:Linus: please write good git commit messages by codex on Monday November 28, 2011 @03:28AM (#3285094)
Couldn't our woes be solved with something as simple as soft-wrap with a tweak:

soft-wrap:

- to allow the presentation layer to soft-wrap a line, just don't add a newline.

- for new paragraphs, just add two newlines as usual

- for indent sensitive code, diagrams, etc. add newlines where appropriate, taking care to not exceed 74 columns for any line. Everyone does this already.

+ tweak:

- in the presentation layer, soft-wrap all lines except those less than 74 characters long.

This isn't perfect for terminals less than 80 characters wide, in that the diagrams won't fit, but nobody uses narrow terminals, and Linus' scheme is even more broken for this case, so it's strictly better. It also allows one to easily distinguish diagrams from non diagrams by eyeballing the text flow. Best of all, it makes fewer assumptions about terminal width.

Re:Linus: please write good git commit messages by JoshTriplett on Monday November 28, 2011 @04:06AM (#3285187)
Text that shouldn't wrap can exceed 74 characters. Some examples: log messages, transcripts, large tables. So, no, that wouldn't suffice.
Re:Linus: please write good git commit messages by timknauf on Monday November 28, 2011 @01:18PM (#3286933)
But how are those log messages, transcripts and large tables all that much better off under the current system? If a console is only 80 characters wide, they're still going to either disappear off the right edge or (as with most consoles I can think of) get soft-wrapped by the console anyway.
Re:Linus: please write good git commit messages by atomicdog on Monday November 28, 2011 @10:20AM (#3286165)
>would then require extra complexity to provide a syntax for lines that should not get wrapped,

And what's stopping someone implementing this?

Re:Linus: please write good git commit messages by JoshTriplett on Monday November 28, 2011 @11:28AM (#3286476)
> And what's stopping someone implementing this?

Most likely, not wanting to inflict such a syntax on git users, when the current approach works just fine.

But nothing stops someone from writing a patch with an off-by-default option for such a syntax, and proposing it for inclusion.

Re:Linus: please write good git commit messages by jacknagel on Sunday November 27, 2011 @01:26PM (#3282968)
git-log and friends indent the commit message by four spaces on the left, so wrapping at ~72 chars gives it symmetry on 80 column terminals. By wrapping it yourself, you decide where line breaks should be, not the presentation machinery.

The optimal human-readable line length is something like 66 characters. It's much easier to quickly scan a log message that's 72 characters wide vs. one that is 200 characters wide.

Re:Linus: please write good git commit messages by harlanlewis on Sunday November 27, 2011 @02:14PM (#3283120)
Tangent time!

"The optimal human-readable line length" isn't really something that exists, even if we make lots of assumptions about basic stuff like font size, avg word length, and color contrast.

Here's a quick study on the reading speed and comprehension of character line lengths (cl) between 35 and 95 for reference: http://psychology.wichita.edu/surl/usabilitynews/72/LineLeng...

- most efficient reading (speed/accuracy) at 95cl

- line length does not affect comprehension

But here's the head spinner:

- 60% _preferred_ either 35cl or 95cl

- 100% _least preferred_ 35cl (45%) or 95cl (55%)

Line length is an easy thing to assume everyone perceives the same way, but even given a consistent environment (definitely not a given in this age of increasingly diverse device dimensions) there's a wide range of preferences with little real impact on readability. Unless, of course, your assumptions about readability clash with the user's preferences or reading environment.

Put simply - make your life easy and reduce problems by just letting the user decide.

Re:Linus: please write good git commit messages by njonsson on Sunday November 27, 2011 @01:48PM (#3283049)
Making semantic line breaks (such as for bullets) is understandable, but it still feels wrong that we’re otherwise doing the job of `fold`. I started breaking lines in commit messages because it’s convention, but I still believe this is a tooling issue.

This shell script wraps wide commit messages to the width of your console.

    GIT_PAGER="fold -s -w`stty size | awk '{print $2}'` | less" git log $@
Re:Linus: please write good git commit messages by wnoise on Sunday November 27, 2011 @06:19PM (#3283701)
You might be interested in the program "par", which uses dynamic programming to optimize the line breaks, and can automatically handle such things as text prefixed by "> ".

http://www.nicemice.net/par/

Re:Linus: please write good git commit messages by kisielk on Sunday November 27, 2011 @03:09PM (#3283257)
Doesn't mean humans have to do it. When using vim for git commit messages it wraps them to 74 characters for me.
Re:Linus: please write good git commit messages by barumrho on Sunday November 27, 2011 @04:19PM (#3283444)
I hate to ask an off-topic question here, but is it considered good/bad practice to word-wrap plain text emails?
Re:Linus: please write good git commit messages by JoshTriplett on Sunday November 27, 2011 @10:15PM (#3284309)
Good practice. If you don't word-wrap plain-text emails, each paragraph will show up as one long line; the program reading your mail on the other end can't wrap it automatically, because it might represent code, ASCII art, terminal transcripts, or something else that shouldn't get wrapped.

So, wrap your paragraphs in plain-text email at some sensible column. Common convention suggests 72, because that allows for a few rounds of quoting before it passes 80.

Re:Linus: please write good git commit messages by caf on Sunday November 27, 2011 @06:41PM (#3283739)
This might not actually be that off-topic, because I think the underlying reason that git commit messages are stored line-wrapped is for ease of sending them unmolested through email.
Re:Linus: please write good git commit messages by telemachos on Sunday November 27, 2011 @04:27PM (#3283467)
I think so, yes. Certainly, something like this is very common in Mutt configuration files:

    set editor="vim -c 'set tw=75 ft=mail noautoindent'"
The 'set tw=75' bit, sets the text width to 75 columns.
Re:Linus: please write good git commit messages by JoshTriplett on Sunday November 27, 2011 @10:16PM (#3284312)
Not actually necessary these days. vim knows to match the names used for mutt temporary files, and automatically puts uses mail mode and a sensible text width.
Re:Linus: please write good git commit messages by pyre on Monday November 28, 2011 @03:08AM (#3285053)
IIRC tw=72 is set whenever you change the filetype to 'mail'
Re:Linus: please write good git commit messages by nodata on Monday November 28, 2011 @04:45AM (#3285265)
It makes the committer think longer about their commit message.