git-merge-one-file: style cleanup
Update style to match Documentation/CodingGuidelines. Signed-off-by: Kevin Bracey <kevin@bracey.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Kevin Bracey committed
Mar 24, 2013 at 14:26 UTC
333ea38db95c77fad8b18daa80bbf0f96fee556c
1 file changed
+17
-9
git-merge-one-file.sh
+17
-9
@@ -27,7 +27,7 @@ SUBDIRECTORY_OK=Yes
27
cd_to_toplevel
28
require_work_tree
29
30
-if ! test "$#" -eq 7
30
+if test $# != 7
31
then
32
echo "$LONG_USAGE"
33
exit 1
@@ -38,7 +38,8 @@ case "${1:-.}${2:-.}${3:-.}" in
38
# Deleted in both or deleted in one and unchanged in the other
39
#
40
"$1.." | "$1.$1" | "$1$1.")
41
- if [ "$2" ]; then
41
+ if test -n "$2"
42
+ then
43
echo "Removing $4"
44
else
45
# read-tree checked that index matches HEAD already,
@@ -48,7 +49,8 @@ case "${1:-.}${2:-.}${3:-.}" in
49
# we do not have it in the index, though.
50
exec git update-index --remove -- "$4"
51
fi
51
- if test -f "$4"; then
52
+ if test -f "$4"
53
+ then
54
rm -f -- "$4" &&
55
rmdir -p "$(expr "z$4" : 'z\(.*\)/')" 2>/dev/null || :
56
fi &&
@@ -78,7 +80,8 @@ case "${1:-.}${2:-.}${3:-.}" in
80
# Added in both, identically (check for same permissions).
81
#
82
".$3$2")
81
- if [ "$6" != "$7" ]; then
83
+ if test "$6" != "$7"
84
+ then
85
echo "ERROR: File $4 added identically in both branches,"
86
echo "ERROR: but permissions conflict $6->$7."
87
exit 1
@@ -121,7 +124,8 @@ case "${1:-.}${2:-.}${3:-.}" in
124
git merge-file "$src1" "$orig" "$src2"
125
ret=$?
126
msg=
124
- if [ $ret -ne 0 ]; then
127
+ if test $ret != 0
128
+ then
129
msg='content conflict'
130
fi
131
@@ -130,18 +134,22 @@ case "${1:-.}${2:-.}${3:-.}" in
134
git checkout-index -f --stage=2 -- "$4" && cat "$src1" >"$4" || exit 1
135
rm -f -- "$orig" "$src1" "$src2"
136
133
- if [ "$6" != "$7" ]; then
134
- if [ -n "$msg" ]; then
137
+ if test "$6" != "$7"
138
+ then
139
+ if test -n "$msg"
140
+ then
141
msg="$msg, "
142
fi
143
msg="${msg}permissions conflict: $5->$6,$7"
144
ret=1
145
fi
140
- if [ "$1" = '' ]; then
146
+ if test -z "$1"
147
+ then
148
ret=1
149
fi
150
144
- if [ $ret -ne 0 ]; then
151
+ if test $ret != 0
152
+ then
153
echo "ERROR: $msg in $4"
154
exit 1
155
fi