]> git.ipfire.org Git - thirdparty/git.git/blame - git-merge-resolve.sh
i18n: avoid parenthesized string as array initializer
[thirdparty/git.git] / git-merge-resolve.sh
CommitLineData
91063bbc
JH
1#!/bin/sh
2#
3# Copyright (c) 2005 Linus Torvalds
2276aa6c 4# Copyright (c) 2005 Junio C Hamano
91063bbc 5#
3dff5379 6# Resolve two trees, using enhanced multi-base read-tree.
91063bbc
JH
7
8# The first parameters up to -- are merge bases; the rest are heads.
9bases= head= remotes= sep_seen=
10for arg
11do
12 case ",$sep_seen,$head,$arg," in
13 *,--,)
14 sep_seen=yes
15 ;;
16 ,yes,,*)
17 head=$arg
18 ;;
19 ,yes,*)
20 remotes="$remotes$arg "
21 ;;
22 *)
23 bases="$bases$arg "
24 ;;
25 esac
26done
27
7d3c82a7 28# Give up if we are given two or more remotes -- not handling octopus.
91063bbc
JH
29case "$remotes" in
30?*' '?*)
31 exit 2 ;;
32esac
33
88f8f0a5
FK
34# Give up if this is a baseless merge.
35if test '' = "$bases"
36then
37 exit 2
38fi
39
7bd93c1c 40git update-index -q --refresh
5be60078 41git read-tree -u -m --aggressive $bases $head $remotes || exit 2
91063bbc 42echo "Trying simple merge."
7bd93c1c 43if result_tree=$(git write-tree 2>/dev/null)
91063bbc
JH
44then
45 exit 0
46else
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
53 fi
54fi