ffffffffffffffff
  1   ˆl–Ðz¾”ËmJeAàq¶ÔÅ£Æ„Mÿ_ŒuÐb&=LyYÿÆÅ 8S    #!/bin/sh
#
# Copyright (c) 2005 Junio C Hamano
#

OPTIONS_KEEPDASHDASH=
OPTIONS_SPEC="\
git merge [options] <remote>...
git merge [options] <msg> HEAD <remote>
--
stat                 show a diffstat at the end of the merge
n                    don't show a diffstat at the end of the merge
summary              (synonym to --stat)
log                  add list of one-line log to merge commit message
squash               create a single commit instead of doing a merge
commit               perform a commit if the merge succeeds (default)
ff                   allow fast-forward (default)
ff-only              abort if fast-forward is not possible
rerere-autoupdate    update index with any reused conflict resolution
s,strategy=          merge strategy to use
X=                   option for selected merge strategy
m,message=           message to be used for the merge commit (if any)
"

SUBDIRECTORY_OK=Yes
. git-sh-setup
require_work_tree
cd_to_toplevel

test -z "$(git ls-files -u)" ||
	die "Merge is not possible because you have unmerged files."

! test -e "$GIT_DIR/MERGE_HEAD" ||
	die 'You have not concluded your merge (MERGE_HEAD exists).'

LF='
'

all_strategies='recur recursive octopus resolve stupid ours subtree'
all_strategies="$all_strategies recursive-ours recursive-theirs"
not_strategies='base file index tree'
default_twohead_strategies='recursive'
default_octopus_strategies='octopus'
no_fast_forward_strategies='subtree ours'
no_trivial_strategies='recursive recur subtree ours recursive-ours recursive-theirs'
use_strategies=
xopt=

allow_fast_forward=t
fast_forward_only=
allow_trivial_merge=t
squash= no_commit= log_arg= rr_arg=

dropsave() {
	rm -f -- "$GIT_DIR/MERGE_HEAD" "$GIT_DIR/MERGE_MSG" \
		 "$GIT_DIR/MERGE_STASH" "$GIT_DIR/MERGE_MODE" || exit 1
}

savestate() {
	# Stash away any local modifications.
	git stash create >"$GIT_DIR/MERGE_STASH"
}

restorestate() {
        if test -f "$GIT_DIR/MERGE_STASH"
	then
		git reset --hard $head >/dev/null
		git stash apply $(cat "$GIT_DIR/MERGE_STASH")
		git update-index --refresh >/dev/null
	fi
}

finish_up_to_date () {
	case "$squash" in
	t)
		echo "$1 (nothing to squash)" ;;
	'')
		echo "$1" ;;
	esac
	dropsave
}

squash_message () {
	echo Squashed commit of the following:
	echo
	git log --no-merges --pretty=medium ^"$head" $remoteheads
}

finish () {
	if test '' = "$2"
	then
		rlogm="$GIT_REFLOG_ACTION"
	else
		echo "$2"
		rlogm="$GIT_REFLOG_ACTION: $2"
	fi
	case "$squash" in
	t)
		echo "Squash commit -- not updating HEAD"
		squash_message >"$GIT_DIR/SQUASH_MSG"
		;;
	'')
		case "$merge_msg" in
		'')
			echo "No merge message -- not updating HEAD"
			;;
		*)
			git update-ref -m "$rlogm" HEAD "$1" "$head" || exit 1
			git gc --auto
			;;
		esac
		;;
	esac
	case "$1" in
	'')
		;;
	?*)
		if test "$show_diffstat" = t
		then
			# We want color (if set), but no pager
			GIT_PAGER='' git diff --stat --summary -M "$head" "$1"
		fi
		;;
	esac

	# Run a post-merge hook
        if test -x "$GIT_DIR"/hooks/post-merge
        then
	    case "$squash" in
	    t)
                "$GIT_DIR"/hooks/post-merge 1
		;;
	    '')
                "$GIT_DIR"/hooks/post-merge 0
		;;
	    esac
        fi
}

merge_name () {
	remote="$1"
	rh=$(git rev-parse --verify "$remote^0" 2>/dev/null) || return
	if truname=$(expr "$remote" : '\(.*\)~[0-9]*$') &&
		git show-ref -q --verify "refs/heads/$truname" 2>/dev/null
	then
		echo "$rh		branch '$truname' (early part) of ."
		return
	fi
	if found_ref=$(git rev-parse --symbolic-full-name --verify \
							"$remote" 2>/dev/null)
	then
		expanded=$(git check-ref-format --branch "$remote") ||
			exit
		if test "${found_ref#refs/heads/}" != "$found_ref"
		then
			echo "$rh		branch '$expanded' of ."
			return
		elif test "${found_ref#refs/remotes/}" != "$found_ref"
		then
			echo "$rh		remote branch '$expanded' of ."
			return
		fi
	fi
	if test "$remote" = "FETCH_HEAD" -a -r "$GIT_DIR/FETCH_HEAD"
	then
		sed -e 's/	not-for-merge	/		/' -e 1q \
			"$GIT_DIR/FETCH_HEAD"
		return
	f