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] have merge put FETCH_HEAD data in commit message
Date: Wed, 21 Mar 2007 08:37:07 -0700 [thread overview]
Message-ID: <7v648u38ws.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: 20070321120643.GI20583@mellanox.co.il
"Michael S. Tsirkin" <mst@dev•mellanox.co.il> writes:
> Hi!
> I often like to fetch some code from others, review and
> then merge. So:
>
> git fetch <URL>
> git log -p FETCH_HEAD
> git merge FETCH_HEAD
>
> which is all good but gets me this message in commit log:
>
> Merge commit 'FETCH_HEAD' into master
>
> which is not very informative.
> I can always fix this up with git commit --amend, but
> I'd like to avoid the extra step.
>
> Would the following patch be appropriate?
>
> Signed-off-by: Michael S. Tsirkin <mst@dev•mellanox.co.il>
Would "Hi!" and "Would the following be appropriate?" be part of
the final commit log message?
I often hear from people who seems to like "fetch & merge",
instead of "pull & reset ORIG_HEAD", as a workflow to avoid
undesirable merging. This might largely be a matter of taste,
but from philosophical point of view, fetch & merge is a sign of
distrust (your default is not to merge, and you merge only when
you choose to), and pull & reset is the opposite (your default
is to merge, and after you inspect you may choose not to merge).
Tool support to encourage the former feels somewhat wrong.
Having said that, since that comes up every now and then, I
suspect it might make sense to have an optional behaviour in
"git pull" that lets you say...
$ git pull --preview $URL $refspec
which runs the following:
. git fetch
. git log -p `sed -e '/ not-for-merge /d'\
. -e 's/ .*//' $GIT_DIR/FETCH_HEAD` \
. --not HEAD
. asks you if you want to conclude this with a merge
. git merge if told, otherwise abort.
The "git-log" above reads "give me the commits that are
reachable from commits that are scheduled for merge but not in
the current HEAD", i.e. the ones that will get merged.
> diff --git a/git-merge.sh b/git-merge.sh
> index 8759c5a..629611b 100755
> --- a/git-merge.sh
> +++ b/git-merge.sh
> @@ -108,6 +108,10 @@ merge_name () {
> git-show-ref -q --verify "refs/heads/$truname" 2>/dev/null
> then
> echo "$rh branch '$truname' (early part) of ."
> + elif test -r "$GIT_DIR/$remote"
> + then
> + echo -n "$rh "
> + grep -v not-for-merge "$GIT_DIR/$remote"
> else
> echo "$rh commit '$remote'"
> fi
This 'not-for-merge' grep is only good while merging FETCH_HEAD,
and will not work for any other random stuff in "$GIT_DIR", so
at least it should be more specific, not just checking if it is
the name of a readable file in $GIT_DIR. Somebody might find
good usecases for doing "git merge ORIG_HEAD" or "git merge
refs/bases/tutorial", for example, and your echo & grep would do
something "interesting".
Every time I added "echo -n" from my sloppiness, somebody sent
in a patch to replace it with "printf". I think people on non
Linux platforms would hate you for using "echo -n" (I should bug
Tytso about this with git-mergetool).
I am not sure what you meant by echo -n and grep -v. Other
codepaths in the if-else chain seems to create $rh (the value of
the single commit being merged) followed by two tabs followed by
the message, and each line in $GIT_DIR/FETCH_HEAD is already in
that format, so I suspect your code duplicates the commit object
name twice?
Even when you fetch more than one branch in FETCH_HEAD, using
FETCH_HEAD as an SHA-1 expression always picks up the object
name on the first line (iow "git merge FETCH_HEAD" will not
create an Octopus), so grepping for lines without not-for-merge
marker is not correct either.
You would probably want something like:
...
elif test FETCH_HEAD = "$remote" && test -r "$GIT_DIR/FETCH_HEAD"
then
sed -e 's/ not-for-merge / /' \
-e 1q "$GIT_DIR/FETCH_HEAD"
else
...
next prev parent reply other threads:[~2007-03-21 15:37 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 [this message]
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 ` [PATCH] display shortlog after git-commit Junio C Hamano
2007-04-15 10:33 ` 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=7v648u38ws.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