From: Junio C Hamano <junkio@cox•net>
To: "Michael S. Tsirkin" <mst@dev•mellanox.co.il>
Cc: Git Mailing List <git@vger•kernel.org>
Subject: Re: [PATCH] display shortlog after git-commit
Date: Wed, 04 Apr 2007 01:15:53 -0700 [thread overview]
Message-ID: <7vd52k7dxi.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <20070404070135.GF31984@mellanox.co.il> (Michael S. Tsirkin's message of "Wed, 4 Apr 2007 10:01:35 +0300")
"Michael S. Tsirkin" <mst@dev•mellanox.co.il> writes:
>> I actually find it awkward that author/summary information is never
>> shown during git commit - sometimes one does git commit
>> on a machine where GIT_AUTHOR_EMAIL has not been setup
>> correctly, and the result often is mst@mst-desktop.(none).
That is something that needs to be set up once. I do not think
it justifies wasting three more lines (one of them being an
empty line) per every commit.
>> Or people sometimes forget that the first line will show up
>> in the pretty=short summary and the result is that what
>> ends up being there is just 2 first lines of the long description.
>>
>> One has to remember to always do git log --pretty=short
>> after commit to verify that one did get these details right.
>> Ideas:
>> - Maybe have git-commit display shortlog summary for commit just created?
>
> Hopefully this will make people fix the git config up and amend their commits themselves.
> Does this sound like a good idea?
Maybe protect it with "[user] novice" in .git/config? Otherwise
I think it gets too noisy once you get used to it.
I think reviewing and fixing is best done in the editor (that's
why git-commit does not start reading from stdin when it expects
you to type a log message, but gives you an editor), and
pointing out a mistake after the fact, while it is probably
better than not pointing out at all, is not all that useful. If
there is no mistake, it is just an added noise, and if there is
a mistake, the user needs to take another action (i.e. --amend)
to correct it.
I think a much better thing you could do is to have a mode that
the commit log message editor is started with something like
this...
----------------------------------------------------------------
From: A U Thor <au.thor@example•com>
Subject: << the summary of the commit comes here >>
# << more detailed explanations come here >>
# Please enter the commit message for your changes.
# (comment lines starting with '#' will not be included)
# On branch 'master'
# Changes to be committed:
# ...
----------------------------------------------------------------
and teach git-commit to notice the first paragraph that is
formatted like RFC2822 headers, and do appropriate things.
"Something like" this patch, although this time I have these two
words in quotes because I know the part to unmunge the buffer
needs more work.
diff --git a/git-commit.sh b/git-commit.sh
index 292cf96..d7a7b0b 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -546,10 +546,13 @@ else
fi
set_reflog_action "$rloga"
+summary_mark='<< the summary of the commit comes here >>'
if test -z "$no_edit"
then
{
+ echo "$summary_mark"
echo ""
+ echo "# << more detailed explanations come here >>"
echo "# Please enter the commit message for your changes."
echo "# (Comment lines starting with '#' will not be included)"
test -z "$only_include_assumed" || echo "$only_include_assumed"
@@ -579,7 +582,34 @@ case "$no_edit" in
esac
git-var GIT_AUTHOR_IDENT > /dev/null || die
git-var GIT_COMMITTER_IDENT > /dev/null || die
- ${VISUAL:-${EDITOR:-vi}} "$GIT_DIR/COMMIT_EDITMSG"
+ {
+ echo "From: $(expr "$(git-var GIT_AUTHOR_IDENT)" : '\(.*>\)')"
+ sed -e '1s/^/Subject: /' "$GIT_DIR/COMMIT_EDITMSG"
+ echo ""
+ } >"$GIT_DIR/COMMIT_EDITMSG+"
+ mv "$GIT_DIR/COMMIT_EDITMSG+" "$GIT_DIR/COMMIT_EDITMSG"
+ ${VISUAL:-${EDITOR:-vi}} "$GIT_DIR/COMMIT_EDITMSG" || exit
+
+ AU=$(sed -n -e '
+ /^$/q
+ /^From: /{
+ s///p
+ q
+ }' "$GIT_DIR/COMMIT_EDITMSG")
+ if test -n "$AU" &&
+ AN=$(expr "$AU" : '\(.*[^ ]\) *<') &&
+ AE=$(expr "$AU" : '.*[^ ] *<\(.*\)>$')
+ then
+ GIT_AUTHOR_NAME=$AN
+ GIT_AUTHOR_EMAIL=$AE
+ export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL
+ fi
+ sed -e '
+ /^From: /d
+ /^Subject: '"$summary_mark"'/d
+ s/^Subject: //
+ ' "$GIT_DIR/COMMIT_EDITMSG" >"$GIT_DIR/COMMIT_EDITMSG+"
+ mv "$GIT_DIR/COMMIT_EDITMSG+" "$GIT_DIR/COMMIT_EDITMSG"
;;
esac
next prev parent reply other threads:[~2007-04-04 8:16 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-21 12:06 [PATCH] have merge put FETCH_HEAD data in commit message Michael S. Tsirkin
2007-03-21 15:37 ` Junio C Hamano
2007-03-22 5:02 ` Michael S. Tsirkin
2007-03-22 5:09 ` Junio C Hamano
2007-03-22 6:28 ` Michael S. Tsirkin
2007-03-22 7:15 ` Junio C Hamano
2007-03-22 7:41 ` Michael S. Tsirkin
2007-03-22 8:21 ` Junio C Hamano
2007-03-22 8:37 ` Michael S. Tsirkin
2007-03-22 10:31 ` Junio C Hamano
2007-03-22 10:40 ` Michael S. Tsirkin
2007-03-24 10:21 ` Junio C Hamano
2007-04-04 6:02 ` Michael S. Tsirkin
2007-04-04 6:09 ` Junio C Hamano
2007-04-04 6:18 ` Michael S. Tsirkin
2007-04-04 6:19 ` Shawn O. Pearce
2007-04-04 6:25 ` Junio C Hamano
2007-04-04 6:35 ` Shawn O. Pearce
2007-04-04 6:24 ` Junio C Hamano
2007-04-04 7:01 ` [PATCH] display shortlog after git-commit Michael S. Tsirkin
2007-04-04 7:22 ` Junio C Hamano
2007-04-15 22:39 ` Michael S. Tsirkin
2007-04-15 23:08 ` Junio C Hamano
2007-04-16 3:53 ` [PATCH] display the subject of the commit just made Michael S. Tsirkin
2007-04-16 5:16 ` Junio C Hamano
2007-04-16 5:40 ` Michael S. Tsirkin
2007-04-16 6:17 ` Junio C Hamano
2007-04-16 5:51 ` Michael S. Tsirkin
2007-04-16 6:01 ` Junio C Hamano
2007-04-16 6:18 ` Michael S. Tsirkin
2007-04-16 6:51 ` Michael S. Tsirkin
2007-04-16 7:00 ` Junio C Hamano
2007-04-16 7:11 ` Shawn O. Pearce
2007-04-16 7:59 ` Michael S. Tsirkin
2007-04-16 12:56 ` Alex Riesen
2007-04-16 17:46 ` Junio C Hamano
2007-04-16 5:34 ` [PATCH] display shortlog after git-commit Michael S. Tsirkin
2007-04-16 6:04 ` Junio C Hamano
2007-04-16 6:26 ` Michael S. Tsirkin
2007-04-16 14:40 ` [PATCH] remove shortlog from git-commit output Michael S. Tsirkin
2007-04-16 15:02 ` Julian Phillips
2007-04-16 18:23 ` Michael S. Tsirkin
2007-04-16 20:21 ` Julian Phillips
2007-04-17 6:02 ` Michael S. Tsirkin
2007-04-17 7:27 ` Julian Phillips
2007-04-04 8:15 ` Junio C Hamano [this message]
2007-04-15 10:33 ` [PATCH] display shortlog after git-commit Michael S. Tsirkin
2007-04-15 19:57 ` Junio C Hamano
2007-04-15 20:09 ` Michael S. Tsirkin
2007-04-15 20:26 ` Andy Parkins
2007-04-15 20:34 ` Michael S. Tsirkin
2007-04-04 6:24 ` [PATCH] wt-status: show author info if status.showauthor is set Jeff King
2007-04-04 6:32 ` Junio C Hamano
2007-04-04 6:49 ` Michael S. Tsirkin
2007-04-04 6:52 ` Junio C Hamano
2007-04-04 6:55 ` Shawn O. Pearce
2007-04-04 13:28 ` Jakub Narebski
2007-03-23 13:57 ` [PATCH] have merge put FETCH_HEAD data in commit message Jakub Narebski
2007-03-23 13:59 ` J. Bruce Fields
2007-03-23 14:23 ` Jakub Narebski
2007-03-23 15:33 ` J. Bruce Fields
2007-03-24 0:03 ` Jakub Narebski
2007-03-22 9:07 ` [PATCH] Put FETCH_HEAD data in merge " Michael S. Tsirkin
2007-03-22 10:01 ` Junio C Hamano
2007-03-22 8:33 ` [PATCH] have merge put FETCH_HEAD data in " Jeff King
2007-03-22 8:51 ` Junio C Hamano
2007-03-22 9:09 ` Jeff King
2007-03-22 9:10 ` Andy Parkins
2007-03-21 17:29 ` [PATCHv2] put FETCH_HEAD data in merge " Michael S. Tsirkin
2007-03-21 18:09 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vd52k7dxi.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox$(echo .)net \
--cc=git@vger$(echo .)kernel.org \
--cc=mst@dev$(echo .)mellanox.co.il \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox