Skip to content

Commit 333ea38

Browse files
kjbracey2gitster
authored andcommitted
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>
1 parent 530333c commit 333ea38

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

git-merge-one-file.sh

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ SUBDIRECTORY_OK=Yes
2727
cd_to_toplevel
2828
require_work_tree
2929

30-
if ! test "$#" -eq 7
30+
if test $# != 7
3131
then
3232
echo "$LONG_USAGE"
3333
exit 1
@@ -38,7 +38,8 @@ case "${1:-.}${2:-.}${3:-.}" in
3838
# Deleted in both or deleted in one and unchanged in the other
3939
#
4040
"$1.." | "$1.$1" | "$1$1.")
41-
if [ "$2" ]; then
41+
if test -n "$2"
42+
then
4243
echo "Removing $4"
4344
else
4445
# read-tree checked that index matches HEAD already,
@@ -48,7 +49,8 @@ case "${1:-.}${2:-.}${3:-.}" in
4849
# we do not have it in the index, though.
4950
exec git update-index --remove -- "$4"
5051
fi
51-
if test -f "$4"; then
52+
if test -f "$4"
53+
then
5254
rm -f -- "$4" &&
5355
rmdir -p "$(expr "z$4" : 'z\(.*\)/')" 2>/dev/null || :
5456
fi &&
@@ -78,7 +80,8 @@ case "${1:-.}${2:-.}${3:-.}" in
7880
# Added in both, identically (check for same permissions).
7981
#
8082
".$3$2")
81-
if [ "$6" != "$7" ]; then
83+
if test "$6" != "$7"
84+
then
8285
echo "ERROR: File $4 added identically in both branches,"
8386
echo "ERROR: but permissions conflict $6->$7."
8487
exit 1
@@ -121,7 +124,8 @@ case "${1:-.}${2:-.}${3:-.}" in
121124
git merge-file "$src1" "$orig" "$src2"
122125
ret=$?
123126
msg=
124-
if [ $ret -ne 0 ]; then
127+
if test $ret != 0
128+
then
125129
msg='content conflict'
126130
fi
127131

@@ -130,18 +134,22 @@ case "${1:-.}${2:-.}${3:-.}" in
130134
git checkout-index -f --stage=2 -- "$4" && cat "$src1" >"$4" || exit 1
131135
rm -f -- "$orig" "$src1" "$src2"
132136

133-
if [ "$6" != "$7" ]; then
134-
if [ -n "$msg" ]; then
137+
if test "$6" != "$7"
138+
then
139+
if test -n "$msg"
140+
then
135141
msg="$msg, "
136142
fi
137143
msg="${msg}permissions conflict: $5->$6,$7"
138144
ret=1
139145
fi
140-
if [ "$1" = '' ]; then
146+
if test -z "$1"
147+
then
141148
ret=1
142149
fi
143150

144-
if [ $ret -ne 0 ]; then
151+
if test $ret != 0
152+
then
145153
echo "ERROR: $msg in $4"
146154
exit 1
147155
fi

0 commit comments

Comments
 (0)