aboutsummaryrefslogtreecommitdiff
path: root/git-pull-script
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-26 12:26:46 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-26 12:26:46 -0700
commit9831d8f86095edde393e495d7a55cab9d35d5d05 (patch)
tree98315fcaee23937a7c6ae9c84d3449d6985738b4 /git-pull-script
parent812666c8e66a21e668c0789d0422aa5a7db54961 (diff)
downloadgit-9831d8f86095edde393e495d7a55cab9d35d5d05.tar.gz
git-9831d8f86095edde393e495d7a55cab9d35d5d05.tar.xz
git-pull-script: do automatic merges
When the trivial "read-tree" merge fails, fall back on the (equally trivial) automatic merge script instead of forcing the user to do it by hand. When _that_ fails, you get to do a manual merge.
Diffstat (limited to 'git-pull-script')
-rwxr-xr-xgit-pull-script14
1 files changed, 11 insertions, 3 deletions
diff --git a/git-pull-script b/git-pull-script
index 77d68d7da..5111da98e 100755
--- a/git-pull-script
+++ b/git-pull-script
@@ -5,7 +5,8 @@
#
merge_repo=$1
-rm -f .git/MERGE_HEAD
+rm -f .git/MERGE_HEAD .git/ORIG_HEAD
+cp .git/HEAD .git/ORIG_HEAD
echo "Getting object database"
rsync -avz --ignore-existing $merge_repo/objects/. .git/objects/.
@@ -41,8 +42,15 @@ if [ "$common" == "$head" ]; then
fi
echo "Trying to merge $merge_head into $head"
read-tree -m $common_tree $head_tree $merge_tree
-result_tree=$(write-tree) || exit 1
-result_commit=$(echo "Merge $merge_repo" | commit-tree $result_tree -p $head -p $merge_head)
+merge_msg="Merge of $merge_repo"
+result_tree=$(write-tree 2> /dev/null)
+if [ $? -ne 0 ]; then
+ echo "Simple merge failed, trying Automatic merge"
+ merge-cache git-merge-one-file-script -a
+ merge_msg="Automatic merge of $merge_repo"
+ result_tree=$(write-tree) || exit 1
+fi
+result_commit=$(echo "$merge_msg" | commit-tree $result_tree -p $head -p $merge_head)
echo "Committed merge $result_commit"
echo $result_commit > .git/HEAD
checkout-cache -f -a && update-cache --refresh