]>
Commit | Line | Data |
---|---|---|
839a7a06 LT |
1 | #!/bin/sh |
2 | # | |
3 | # This is the git merge script, called with | |
4 | # | |
5 | # $1 - original file (or empty string) | |
6 | # $2 - file in branch1 (or empty string) | |
7 | # $3 - file in branch2 (or empty string) | |
8 | # $4 - pathname in repository | |
9 | # | |
10 | # | |
11 | # Case 1: file removed in both | |
12 | # | |
13 | if [ -z "$2$3" ]; then | |
14 | rm -- "$4" | |
15 | update-cache --remove -- "$4" | |
16 | exit 0 | |
17 | fi | |
18 | # | |
19 | # Case 2: file exists in just one | |
20 | # | |
21 | if [ "$2$3" == "$3$2" ]; then | |
22 | cat "$2$3" > "$4" | |
23 | update-cache --add -- "$4" | |
24 | exit 0 | |
25 | fi | |
26 | # | |
27 | # Case 3: file exists in both | |
28 | # | |
29 | src="$1" | |
30 | if [ -z "$1" ]; then | |
31 | src=/dev/null | |
32 | fi | |
33 | echo "Auto-merging $4" | |
34 | cp "$3" "$4" | |
35 | merge "$4" "$src" "$2" && update-cache --add -- "$4" |