#
merge_repo=$1
+rm -f .git/MERGE_HEAD
+
echo "Getting object database"
-rsync -avz --ignore-existing $merge_repo/ .git/
+rsync -avz --ignore-existing $merge_repo/objects/. .git/objects/.
echo "Getting remote head"
-rsync -avz $merge_repo/HEAD .git/MERGE_HEAD
+rsync -L $merge_repo/HEAD .git/MERGE_HEAD || exit 1
head=$(cat .git/HEAD)
merge_head=$(cat .git/MERGE_HEAD)
echo "Destroying all noncommitted data!"
echo "Kill me within 3 seconds.."
sleep 3
- read-tree $merge_tree && checkout-cache -f -a && update-cache --refresh
+ read-tree -m $merge_tree && checkout-cache -f -a && update-cache --refresh
echo $merge_head > .git/HEAD
exit 0
fi
result_commit=$(echo "Merge $merge_repo" | commit-tree $result_tree -p $head -p $merge_head)
echo "Committed merge $result_commit"
echo $result_commit > .git/HEAD
-read-tree $result_tree && checkout-cache -f -a && update-cache --refresh
+checkout-cache -f -a && update-cache --refresh