summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 17bcdad)
raw | patch | inline | side by side (parent: 17bcdad)
author | Junio C Hamano <junkio@cox.net> | |
Wed, 22 Nov 2006 05:13:28 +0000 (21:13 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 22 Nov 2006 05:18:07 +0000 (21:18 -0800) |
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-merge.sh | patch | blob | history |
diff --git a/git-merge.sh b/git-merge.sh
index 25deb1e867ec01c65d223733a22edd98f18e241c..dd4e83dede72ee4b4c85632aa582ef8a25d00447 100755 (executable)
--- a/git-merge.sh
+++ b/git-merge.sh
shift
head_arg="$1"
shift
+elif ! git-rev-parse --verify HEAD 2>/dev/null
+then
+ # If the merged head is a valid one there is no reason to
+ # forbid "git merge" into a branch yet to be born. We do
+ # the same for "git pull".
+ if test 1 -ne $#
+ then
+ echo >&2 "Can merge only exactly one commit into empty head"
+ exit 1
+ fi
+
+ rh=$(git rev-parse --verify "$1^0") ||
+ die "$1 - not something we can merge"
+
+ git-update-ref -m "initial pull" HEAD "$rh" "" &&
+ git-read-tree --reset -u HEAD
+ exit
+
else
# We are invoked directly as the first-class UI.
head_arg=HEAD