git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Holmsand <holmsand@gmail.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: 'git commit' duplicates parents?
Date: Mon, 20 Jun 2005 11:48:26 +0200	[thread overview]
Message-ID: <42B690EA.2080605@gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0506191958010.2268@ppc970.osdl.org>

[-- Attachment #1: Type: text/plain, Size: 687 bytes --]

Linus Torvalds wrote:
> Keep the complaints coming when something doesn't work the way it should.  
> I'll continue to try to blame your incompetence as much as I humanly can,
> but hey, some of it is occasionally mine too... ;(

Well, since it's obviously complaint time :-)

git-resolve-script still seems a bit too eager to write MERGE_HEAD and 
ORIG_HEAD - they only make sense if there's actually been any merging 
done, don't they?

Patch below shows what I mean.

/dan

---

[PATCH] Make git-resolve-script less eager to write MERGE_HEAD

MERGE_HEAD and ORIG_HEAD should only be written if there's actually
been any merging done.

Signed-off-by: Dan Holmsand <holmsand@gmail.com>

[-- Attachment #2: git-resolve-script.patch.txt --]
[-- Type: text/plain, Size: 1468 bytes --]

diff --git a/git-resolve-script b/git-resolve-script
--- a/git-resolve-script
+++ b/git-resolve-script
@@ -12,8 +12,6 @@ merge_repo="$3"
 : ${GIT_OBJECT_DIRECTORY="${SHA1_FILE_DIRECTORY-"$GIT_DIR/objects"}"}
 
 rm -f "$GIT_DIR"/MERGE_HEAD "$GIT_DIR"/ORIG_HEAD
-echo $head > "$GIT_DIR"/ORIG_HEAD
-echo $merge > "$GIT_DIR"/MERGE_HEAD
 
 #
 # The remote name is just used for the message,
@@ -32,15 +30,13 @@ fi
 
 if [ "$common" == "$merge" ]; then
 	echo "Already up-to-date. Yeeah!"
-	rm -f -- "$GIT_DIR/ORIG_HEAD" "$GIT_DIR/MERGE_HEAD"
 	exit 0
 fi
 if [ "$common" == "$head" ]; then
 	echo "Updating from $head to $merge."
 	git-read-tree -u -m $head $merge || exit 1
 	echo $merge > "$GIT_DIR"/HEAD
-	git-diff-tree -p ORIG_HEAD HEAD | git-apply --stat
-	rm -f -- "$GIT_DIR/ORIG_HEAD" "$GIT_DIR/MERGE_HEAD"
+	git-diff-tree -p $head HEAD | git-apply --stat
 	exit 0
 fi
 echo "Trying to merge $merge into $head"
@@ -51,6 +47,8 @@ if [ $? -ne 0 ]; then
 	echo "Simple merge failed, trying Automatic merge"
 	git-merge-cache -o git-merge-one-file-script -a
 	if [ $? -ne 0 ]; then
+		echo $merge > "$GIT_DIR"/MERGE_HEAD
+		echo $head > "$GIT_DIR"/ORIG_HEAD
 		echo "Automatic merge failed, fix up by hand"
 		exit 1
 	fi
@@ -60,4 +58,3 @@ result_commit=$(echo "$merge_msg" | git-
 echo "Committed merge $result_commit"
 echo $result_commit > "$GIT_DIR"/HEAD
 git-diff-tree -p $head $result_commit | git-apply --stat
-rm -f -- "$GIT_DIR/ORIG_HEAD" "$GIT_DIR/MERGE_HEAD"

  reply	other threads:[~2005-06-20  9:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-19 16:27 'git commit' duplicates parents? Jeff Garzik
2005-06-19 16:32 ` Jeff Garzik
2005-06-20  2:24 ` Linus Torvalds
2005-06-20  2:28   ` Jeff Garzik
2005-06-20  2:33   ` Linus Torvalds
2005-06-20  2:40     ` Jeff Garzik
2005-06-20  3:00       ` Linus Torvalds
2005-06-20  9:48         ` Dan Holmsand [this message]
2005-06-20 15:11           ` Linus Torvalds
2005-06-20 17:20             ` Dan Holmsand
2005-06-20 17:44               ` Linus Torvalds
2005-06-20 18:52                 ` Dan Holmsand

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=42B690EA.2080605@gmail.com \
    --to=holmsand@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).