Skip to content

Commit

Permalink
Merge branch 'sp/merge' (early part)
Browse files Browse the repository at this point in the history
* 'sp/merge' (early part):
  Improve merge performance by avoiding in-index merges.
  • Loading branch information
Junio C Hamano committed Jan 14, 2007
2 parents 3681d40 + c82d711 commit 6de3347
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions git-merge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -301,24 +301,30 @@ f,*)
;;
?,1,*,)
# We are not doing octopus, not fast forward, and have only
# one common. See if it is really trivial.
git var GIT_COMMITTER_IDENT >/dev/null || exit

echo "Trying really trivial in-index merge..."
# one common.
git-update-index --refresh 2>/dev/null
if git-read-tree --trivial -m -u -v $common $head "$1" &&
result_tree=$(git-write-tree)
then
echo "Wonderful."
result_commit=$(
echo "$merge_msg" |
git-commit-tree $result_tree -p HEAD -p "$1"
) || exit
finish "$result_commit" "In-index merge"
dropsave
exit 0
fi
echo "Nope."
case " $use_strategies " in
*' recursive '*|*' recur '*)
: run merge later
;;
*)
# See if it is really trivial.
git var GIT_COMMITTER_IDENT >/dev/null || exit
echo "Trying really trivial in-index merge..."
if git-read-tree --trivial -m -u -v $common $head "$1" &&
result_tree=$(git-write-tree)
then
echo "Wonderful."
result_commit=$(
echo "$merge_msg" |
git-commit-tree $result_tree -p HEAD -p "$1"
) || exit
finish "$result_commit" "In-index merge"
dropsave
exit 0
fi
echo "Nope."
esac
;;
*)
# An octopus. If we can reach all the remote we are up to date.
Expand Down

0 comments on commit 6de3347

Please sign in to comment.