3 # Copyright (c) 2005 Linus Torvalds
12 : ${GIT_OBJECT_DIRECTORY="${SHA1_FILE_DIRECTORY-"$GIT_DIR/objects"}"}
14 rm -f "$GIT_DIR"/MERGE_HEAD
"$GIT_DIR"/ORIG_HEAD
15 echo $head > "$GIT_DIR"/ORIG_HEAD
16 echo $merge > "$GIT_DIR"/MERGE_HEAD
19 # The remote name is just used for the message,
22 if [ "$merge_repo" == "" ]; then
23 echo "git-resolve-script <head> <remote> <merge-repo-name>"
27 common
=$
(git-merge-base
$head $merge)
28 if [ -z "$common" ]; then
29 echo "Unable to find common commit between" $merge $head
33 if [ "$common" == "$merge" ]; then
34 echo "Already up-to-date. Yeeah!"
37 if [ "$common" == "$head" ]; then
38 echo "Updating from $head to $merge."
39 echo "Destroying all noncommitted data!"
40 echo "Kill me within 3 seconds.."
42 git-read-tree
-m $merge && git-checkout-cache
-f -u -a
43 echo $merge > "$GIT_DIR"/HEAD
44 git-diff-tree
-p ORIG_HEAD HEAD | git-apply
--stat
47 echo "Trying to merge $merge into $head"
48 git-read-tree
-m $common $head $merge
49 merge_msg
="Merge of $merge_repo"
50 result_tree
=$
(git-write-tree
2> /dev
/null
)
52 echo "Simple merge failed, trying Automatic merge"
53 git-merge-cache git-merge-one-file-script
-a
54 merge_msg
="Automatic merge of $merge_repo"
55 result_tree
=$
(git-write-tree
) ||
exit 1
57 result_commit
=$
(echo "$merge_msg" | git-commit-tree
$result_tree -p $head -p $merge)
58 echo "Committed merge $result_commit"
59 echo $result_commit > "$GIT_DIR"/HEAD
60 git-checkout-cache
-f -u -a
61 git-diff-tree
-p ORIG_HEAD HEAD | git-apply
--stat