9 rm -f .git
/MERGE_HEAD .git
/ORIG_HEAD
10 echo $head > .git
/ORIG_HEAD
11 echo $merge > .git
/MERGE_HEAD
14 # The remote name is just used for the message,
17 if [ "$merge_repo" == "" ]; then
18 echo "git-resolve-script <head> <remote> <merge-repo-name>"
22 common
=$
(git-merge-base
$head $merge)
23 if [ -z "$common" ]; then
24 echo "Unable to find common commit between" $merge $head
28 if [ "$common" == "$merge" ]; then
29 echo "Already up-to-date. Yeeah!"
32 if [ "$common" == "$head" ]; then
33 echo "Updating from $head to $merge."
34 echo "Destroying all noncommitted data!"
35 echo "Kill me within 3 seconds.."
37 git-read-tree
-m $merge && git-checkout-cache
-f -a && git-update-cache
--refresh
38 echo $merge > .git
/HEAD
39 git-diff-tree
-p ORIG_HEAD HEAD | diffstat
-p1
42 echo "Trying to merge $merge into $head"
43 git-read-tree
-m $common $head $merge
44 merge_msg
="Merge of $merge_repo"
45 result_tree
=$
(git-write-tree
2> /dev
/null
)
47 echo "Simple merge failed, trying Automatic merge"
48 git-merge-cache git-merge-one-file-script
-a
49 merge_msg
="Automatic merge of $merge_repo"
50 result_tree
=$
(git-write-tree
) ||
exit 1
52 result_commit
=$
(echo "$merge_msg" | git-commit-tree
$result_tree -p $head -p $merge_head)
53 echo "Committed merge $result_commit"
54 echo $result_commit > .git
/HEAD
55 git-checkout-cache
-f -a && git-update-cache
--refresh
56 git-diff-tree
-p ORIG_HEAD HEAD | diffstat
-p1