login
Header Space

 
 

Re: [PATCH] have merge put FETCH_HEAD data in commit message

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Michael S. Tsirkin <mst@...>
Cc: Git Mailing List <git@...>
Date: Wednesday, March 21, 2007 - 11:37 am

"Michael S. Tsirkin" <mst@dev.mellanox.co.il> writes:


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.


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
        	...


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] have merge put FETCH_HEAD data in commit message, Junio C Hamano, (Wed Mar 21, 11:37 am)
Re: [PATCH] have merge put FETCH_HEAD data in commit message, Michael S. Tsirkin, (Thu Mar 22, 1:02 am)
Re: [PATCH] have merge put FETCH_HEAD data in commit message, Michael S. Tsirkin, (Thu Mar 22, 2:28 am)
Re: [PATCH] have merge put FETCH_HEAD data in commit message, Michael S. Tsirkin, (Thu Mar 22, 3:41 am)
[PATCH] Put FETCH_HEAD data in merge commit message, Michael S. Tsirkin, (Thu Mar 22, 5:07 am)
Re: [PATCH] Put FETCH_HEAD data in merge commit message, Junio C Hamano, (Thu Mar 22, 6:01 am)
Re: [PATCH] have merge put FETCH_HEAD data in commit message, Michael S. Tsirkin, (Thu Mar 22, 4:37 am)
Re: [PATCH] have merge put FETCH_HEAD data in commit message, Michael S. Tsirkin, (Thu Mar 22, 6:40 am)
Re: [PATCH] have merge put FETCH_HEAD data in commit message, Michael S. Tsirkin, (Wed Apr 4, 2:02 am)
Re: [PATCH] wt-status: show author info if status.showauthor..., Michael S. Tsirkin, (Wed Apr 4, 2:49 am)
[PATCH] display shortlog after git-commit, Michael S. Tsirkin, (Wed Apr 4, 3:01 am)
Re: [PATCH] display shortlog after git-commit, Junio C Hamano, (Wed Apr 4, 4:15 am)
Re: [PATCH] display shortlog after git-commit, Michael S. Tsirkin, (Sun Apr 15, 6:33 am)
Re: [PATCH] display shortlog after git-commit, Junio C Hamano, (Wed Apr 4, 3:22 am)
[PATCH] display shortlog after git-commit, Michael S. Tsirkin, (Sun Apr 15, 6:39 pm)
Re: [PATCH] display shortlog after git-commit, Junio C Hamano, (Sun Apr 15, 7:08 pm)
Re: [PATCH] display shortlog after git-commit, Michael S. Tsirkin, (Mon Apr 16, 1:34 am)
Re: [PATCH] display shortlog after git-commit, Junio C Hamano, (Mon Apr 16, 2:04 am)
[PATCH] remove shortlog from git-commit output, Michael S. Tsirkin, (Mon Apr 16, 10:40 am)
Re: [PATCH] remove shortlog from git-commit output, Julian Phillips, (Mon Apr 16, 11:02 am)
Re: [PATCH] remove shortlog from git-commit output, Michael S. Tsirkin, (Mon Apr 16, 2:23 pm)
Re: [PATCH] remove shortlog from git-commit output, Julian Phillips, (Mon Apr 16, 4:21 pm)
Re: [PATCH] remove shortlog from git-commit output, Michael S. Tsirkin, (Tue Apr 17, 2:02 am)
Re: [PATCH] remove shortlog from git-commit output, Julian Phillips, (Tue Apr 17, 3:27 am)
Re: [PATCH] display shortlog after git-commit, Michael S. Tsirkin, (Mon Apr 16, 2:26 am)
[PATCH] display the subject of the commit just made, Michael S. Tsirkin, (Sun Apr 15, 11:53 pm)
Re: [PATCH] have merge put FETCH_HEAD data in commit message, Michael S. Tsirkin, (Wed Apr 4, 2:18 am)
speck-geostationary