X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=git-octopus.sh;h=2edbf52c42d329bc1cd091f0ec07f6ccf032478e;hb=9754563ca9a99bc0fe233f43202af15704fbed4d;hp=521cc6f3611bcaf5454ad83baf0bec2e0b66483d;hpb=215a7ad1ef790467a4cd3f0dcffbd6e5f04c38f7;p=git.git diff --git a/git-octopus.sh b/git-octopus.sh index 521cc6f3..2edbf52c 100755 --- a/git-octopus.sh +++ b/git-octopus.sh @@ -4,7 +4,7 @@ # # Resolve two or more trees recorded in $GIT_DIR/FETCH_HEAD. # -. git-sh-setup || die "Not a git archive" +. git-sh-setup usage () { die "usage: git octopus" @@ -27,7 +27,7 @@ test "$(git-diff-index --cached "$head")" = "" || # MRC is the current "merge reference commit" # MRT is the current "merge result tree" -MRC=$head MSG= PARENT="-p $head" +MRC=$head PARENT="-p $head" MRT=$(git-write-tree) CNT=1 ;# counting our head NON_FF_MERGE=0 @@ -44,8 +44,6 @@ do CNT=`expr $CNT + 1` PARENT="$PARENT -p $SHA1" - MSG="$MSG - $REPO" if test "$common,$NON_FF_MERGE" = "$MRC,0" then @@ -84,20 +82,9 @@ case "$CNT" in 1) echo "No changes." exit 0 ;; -2) - echo "Not an Octopus; making an ordinary commit." - MSG="Merge "`expr "$MSG" : '. \(.*\)'` ; # remove LF and TAB - ;; -*) - # In an octopus, the original head is just one of the equals, - # so we should list it as such. - HEAD_LINK=`readlink "$GIT_DIR/HEAD"` - MSG="Octopus merge of the following: - - $HEAD_LINK from .$MSG" - ;; esac -result_commit=$(echo "$MSG" | git-commit-tree $MRT $PARENT) +result_commit=$(git-fmt-merge-msg <"$GIT_DIR/FETCH_HEAD" | + git-commit-tree $MRT $PARENT) echo "Committed merge $result_commit" -echo $result_commit >"$GIT_DIR"/HEAD +git-update-ref HEAD $result_commit $head git-diff-tree -p $head $result_commit | git-apply --stat