Mark the variable declarations in .h files as extern
[git/dscho.git] / git-merge-one-file-script
blob3fb43ccb094dd398a753bf264f8532ec380f9087
1 #!/bin/sh
3 # This is the git merge script, called with
5 # $1 - original file SHA1 (or empty)
6 # $2 - file in branch1 SHA1 (or empty)
7 # $3 - file in branch2 SHA1 (or empty)
8 # $4 - pathname in repository
9 # $5 - orignal file mode (or empty)
10 # $6 - file in branch1 mode (or empty)
11 # $7 - file in branch2 mode (or empty)
13 # Handle some trivial cases.. The _really_ trivial cases have
14 # been handled already by git-read-tree, but that one doesn't
15 # do any merges that migth change the tree layout.
17 case "${1:-.}${2:-.}${3:-.}" in
19 # Deleted in both.
21 "$1..")
22 echo "ERROR: $4 is removed in both branches."
23 echo "ERROR: This is a potential rename conflict."
24 exit 1;;
26 # Deleted in one and unchanged in the other.
28 "$1.." | "$1.$1" | "$1$1.")
29 echo "Removing $4"
30 exec git-update-cache --force-remove "$4" ;;
32 # Added in one.
34 ".$2." | "..$3" )
35 case "$6$7" in *7??) mode=+x;; *) mode=-x;; esac
36 echo "Adding $4 with perm $mode."
37 exec git-update-cache --add --cacheinfo "$6$7" "$2$3" "$4" ;;
39 # Added in both (check for same permissions).
41 ".$3$2")
42 if [ "$6" != "$7" ]; then
43 echo "ERROR: File $4 added identically in both branches,"
44 echo "ERROR: but permissions conflict $6->$7."
45 exit 1
47 case "$6" in *7??) mode=+x;; *) mode=-x;; esac
48 echo "Adding $4 with perm $mode"
49 exec git-update-cache --add --cacheinfo "$6" "$2" "$4" ;;
51 # Modified in both, but differently.
53 "$1$2$3")
54 echo "Auto-merging $4."
55 orig=$(git-unpack-file $1)
56 src1=$(git-unpack-file $2)
57 src2=$(git-unpack-file $3)
58 merge "$src2" "$orig" "$src1"
59 ret=$?
60 if [ "$6" != "$7" ]; then
61 echo "ERROR: Permissions $5->$6->$7 don't match."
63 if [ $ret -ne 0 ]; then
64 echo "ERROR: Leaving conflict merge in $src2."
65 exit 1
67 sha1=$(git-write-blob "$src2") || {
68 echo "ERROR: Leaving conflict merge in $src2."
70 exec git-update-cache --add --cacheinfo "$6" $sha1 "$4" ;;
72 echo "ERROR: Not handling case $4: $1 -> $2 -> $3" ;;
73 esac
74 exit 1