Re: 'git commit' duplicates parents?
- From
Dan Holmsand <holmsand@gmail.com>
- Date
- Jun 20, 2005, 09:48 UTC
- Message-ID
- <42B690EA.2080605@gmail.com>
- In-Reply-To
- <Pine.LNX.4.58.0506191958010.2268@ppc970.osdl.org>
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>
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"