add "test-absolute-path" to .gitignore
[git/haiku.git] / git-merge-resolve.sh
blobbb19da2cc15715df9c96ddea18c6d449ce49b6e4
1 #!/bin/sh
3 # Copyright (c) 2005 Linus Torvalds
4 # Copyright (c) 2005 Junio C Hamano
6 # Resolve two trees, using enhanced multi-base read-tree.
8 # The first parameters up to -- are merge bases; the rest are heads.
9 bases= head= remotes= sep_seen=
10 for arg
12 case ",$sep_seen,$head,$arg," in
13 *,--,)
14 sep_seen=yes
16 ,yes,,*)
17 head=$arg
19 ,yes,*)
20 remotes="$remotes$arg "
23 bases="$bases$arg "
25 esac
26 done
28 # Give up if we are given more than two remotes -- not handling octopus.
29 case "$remotes" in
30 ?*' '?*)
31 exit 2 ;;
32 esac
34 # Give up if this is a baseless merge.
35 if test '' = "$bases"
36 then
37 exit 2
40 git update-index --refresh 2>/dev/null
41 git read-tree -u -m --aggressive $bases $head $remotes || exit 2
42 echo "Trying simple merge."
43 if result_tree=$(git write-tree 2>/dev/null)
44 then
45 exit 0
46 else
47 echo "Simple merge failed, trying Automatic merge."
48 if git-merge-index -o git-merge-one-file -a
49 then
50 exit 0
51 else
52 exit 1