List Info

Thread: Automatically line wrap long commit messages.




Automatically line wrap long commit messages.
user name
2006-05-29 08:57:39
When using -m on the command line with git-commit it is not
uncommon
for a long commit message to be entered without line
terminators.
This creates commit objects whose messages are not readable
in
'git log' as the line runs off the screen.

So instead reformat log messages if they are supplied on the
command line.

Signed-off-by: Shawn O. Pearce <spearcespearce.org>
---
 This one might cause some problems for people.  It requires
 'fmt' in order to use log messages on the command line as
well as
 some users may not like having their log messages line
wrapped.
 I'm open to suggestions for how to deal with this but
personally
 this is one feature which I put into pg's commit tool that
I miss
 dearly when working with core GIT.

 git-commit.sh |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/git-commit.sh b/git-commit.sh
index a092b72..e7aa4b1 100755
--- a/git-commit.sh
+++ b/git-commit.sh
 -547,7
+547,12  fi
 
 if test "$log_message" != ''
 then
-	echo "$log_message"
+	# The message came from the command line.  It might
contain very
+	# long lines so reformat it with a target of 60. Note that
we
+	# don't reformat messages created in an editor by the
user as
+	# we should assume they carefully formatted it in some
way.
+	#
+	echo "$log_message" | fmt -w 60
 elif test "$logfile" != ""
 then
 	if test "$logfile" = -
-- 
1.3.3.g45d8

-
To unsubscribe from this list: send the line
"unsubscribe git" in
the body of a message to majordomovger.kernel.org
More majordomo info at  http://vge
r.kernel.org/majordomo-info.html
Automatically line wrap long commit messages.
user name
2006-05-29 09:00:45
On Mon, 2006-05-29 04:57:39 -0400, Shawn Pearce
<spearcespearce.org> wrote:
> When using -m on the command line with git-commit it is
not uncommon
> for a long commit message to be entered without line
terminators.
> This creates commit objects whose messages are not
readable in
> 'git log' as the line runs off the screen.

Uh? Just put it in quotes and press the Enter key when
applicable.

MfG, JBG

-- 
Jan-Benedict Glaw       jbglawlug-owl.de    .
+49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen
Zensur | Gegen Krieg  _ _ O
 für einen Freien Staat voll Freier Bürger"  | im
Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) &
~(NEW_COPYRIGHT_LAW | DRM | TCPA));
Automatically line wrap long commit messages.
user name
2006-05-29 09:14:23
Jan-Benedict Glaw <jbglawlug-owl.de> wrote:
> On Mon, 2006-05-29 04:57:39 -0400, Shawn Pearce
<spearcespearce.org> wrote:
> > When using -m on the command line with git-commit
it is not uncommon
> > for a long commit message to be entered without
line terminators.
> > This creates commit objects whose messages are not
readable in
> > 'git log' as the line runs off the screen.
> 
> Uh? Just put it in quotes and press the Enter key when
applicable.

I realize that.  But I feel that it looks rather ugly on the
command
line, in the resulting message, and is difficult to do well
all of
the time.

For one thing the first line is offset due to the stuff
preeceding
it on the command line, even if you put the -m" on the
next line.
For another it goes nicely with my prior patch of allowing
multiple
-m flags on the command line and merging them into a single
commit
message by treating each option argument as its own
paragraph.

Maybe its just me but I've generally found `fmt` does a
nice job
of line wrapping my text.  I'm writing this email out in vi
with
no thought to line wrapping and will let `fmt` clean it all
up for
me before I sent it.  I do the same thing with all of my
commit
messages; except git-commit won't let me do it from the
command line.

This patch was trying to do that...  but I suspected some
folks
would not like the idea very much.  

-- 
Shawn.
-
To unsubscribe from this list: send the line
"unsubscribe git" in
the body of a message to majordomovger.kernel.org
More majordomo info at  http://vge
r.kernel.org/majordomo-info.html
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )