Skip to content

Commit a98772c

Browse files
jandurovecgitster
authored andcommitted
git-p4: clean-up code style in tests
Preliminary clean-up of testing libraries for git-p4. * spaces added to both sides of () in function definitions in lib-git-p4 * tab indentation added to git-p4 tests when <<- redirection is used Signed-off-by: Jan Durovec <jan.durovec@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent e6ac6e1 commit a98772c

File tree

2 files changed

+42
-42
lines changed

2 files changed

+42
-42
lines changed

t/lib-git-p4.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fi
3333
# Older versions of perforce were available compiled natively for
3434
# cygwin. Those do not accept native windows paths, so make sure
3535
# not to convert for them.
36-
native_path() {
36+
native_path () {
3737
path="$1" &&
3838
if test_have_prereq CYGWIN && ! p4 -V | grep -q CYGWIN
3939
then
@@ -49,7 +49,7 @@ native_path() {
4949
# Attention: This function is not safe again against time offset updates
5050
# at runtime (e.g. via NTP). The 'clock_gettime(CLOCK_MONOTONIC)'
5151
# function could fix that but it is not in Python until 3.3.
52-
time_in_seconds() {
52+
time_in_seconds () {
5353
python -c 'import time; print int(time.time())'
5454
}
5555

@@ -75,7 +75,7 @@ git="$TRASH_DIRECTORY/git"
7575
pidfile="$TRASH_DIRECTORY/p4d.pid"
7676

7777
# Sometimes "prove" seems to hang on exit because p4d is still running
78-
cleanup() {
78+
cleanup () {
7979
if test -f "$pidfile"
8080
then
8181
kill -9 $(cat "$pidfile") 2>/dev/null && exit 255
@@ -89,7 +89,7 @@ trap cleanup EXIT
8989
TMPDIR="$TRASH_DIRECTORY"
9090
export TMPDIR
9191

92-
start_p4d() {
92+
start_p4d () {
9393
mkdir -p "$db" "$cli" "$git" &&
9494
rm -f "$pidfile" &&
9595
(
@@ -151,7 +151,7 @@ start_p4d() {
151151
return 0
152152
}
153153

154-
p4_add_user() {
154+
p4_add_user () {
155155
name=$1 &&
156156
p4 user -f -i <<-EOF
157157
User: $name
@@ -160,23 +160,23 @@ p4_add_user() {
160160
EOF
161161
}
162162

163-
retry_until_success() {
163+
retry_until_success () {
164164
timeout=$(($(time_in_seconds) + $RETRY_TIMEOUT))
165165
until "$@" 2>/dev/null || test $(time_in_seconds) -gt $timeout
166166
do
167167
sleep 1
168168
done
169169
}
170170

171-
retry_until_fail() {
171+
retry_until_fail () {
172172
timeout=$(($(time_in_seconds) + $RETRY_TIMEOUT))
173173
until ! "$@" 2>/dev/null || test $(time_in_seconds) -gt $timeout
174174
do
175175
sleep 1
176176
done
177177
}
178178

179-
kill_p4d() {
179+
kill_p4d () {
180180
pid=$(cat "$pidfile")
181181
retry_until_fail kill $pid
182182
retry_until_fail kill -9 $pid
@@ -186,13 +186,13 @@ kill_p4d() {
186186
retry_until_fail kill -9 $watchdog_pid
187187
}
188188

189-
cleanup_git() {
189+
cleanup_git () {
190190
retry_until_success rm -r "$git"
191191
test_must_fail test -d "$git" &&
192192
retry_until_success mkdir "$git"
193193
}
194194

195-
marshal_dump() {
195+
marshal_dump () {
196196
what=$1 &&
197197
line=${2:-1} &&
198198
cat >"$TRASH_DIRECTORY/marshal-dump.py" <<-EOF &&
@@ -208,7 +208,7 @@ marshal_dump() {
208208
#
209209
# Construct a client with this list of View lines
210210
#
211-
client_view() {
211+
client_view () {
212212
(
213213
cat <<-EOF &&
214214
Client: $P4CLIENT
@@ -222,7 +222,7 @@ client_view() {
222222
) | p4 client -i
223223
}
224224

225-
is_cli_file_writeable() {
225+
is_cli_file_writeable () {
226226
# cygwin version of p4 does not set read-only attr,
227227
# will be marked 444 but -w is true
228228
file="$1" &&

t/t9826-git-p4-keep-empty-commits.sh

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,23 @@ test_expect_success 'Clone repo root path with all history' '
4747
git init . &&
4848
git p4 clone --use-client-spec --destination="$git" //depot@all &&
4949
cat >expect <<-\EOF &&
50-
Remove file 4
51-
[git-p4: depot-paths = "//depot/": change = 6]
50+
Remove file 4
51+
[git-p4: depot-paths = "//depot/": change = 6]
5252
53-
Remove file 3
54-
[git-p4: depot-paths = "//depot/": change = 5]
53+
Remove file 3
54+
[git-p4: depot-paths = "//depot/": change = 5]
5555
56-
Add file 4
57-
[git-p4: depot-paths = "//depot/": change = 4]
56+
Add file 4
57+
[git-p4: depot-paths = "//depot/": change = 4]
5858
59-
Add file 3
60-
[git-p4: depot-paths = "//depot/": change = 3]
59+
Add file 3
60+
[git-p4: depot-paths = "//depot/": change = 3]
6161
62-
Add file 2
63-
[git-p4: depot-paths = "//depot/": change = 2]
62+
Add file 2
63+
[git-p4: depot-paths = "//depot/": change = 2]
6464
65-
Add file 1
66-
[git-p4: depot-paths = "//depot/": change = 1]
65+
Add file 1
66+
[git-p4: depot-paths = "//depot/": change = 1]
6767
6868
EOF
6969
git log --format=%B >actual &&
@@ -80,23 +80,23 @@ test_expect_success 'Clone repo subdir with all history but keep empty commits'
8080
git config git-p4.keepEmptyCommits true &&
8181
git p4 clone --use-client-spec --destination="$git" //depot@all &&
8282
cat >expect <<-\EOF &&
83-
Remove file 4
84-
[git-p4: depot-paths = "//depot/": change = 6]
83+
Remove file 4
84+
[git-p4: depot-paths = "//depot/": change = 6]
8585
86-
Remove file 3
87-
[git-p4: depot-paths = "//depot/": change = 5]
86+
Remove file 3
87+
[git-p4: depot-paths = "//depot/": change = 5]
8888
89-
Add file 4
90-
[git-p4: depot-paths = "//depot/": change = 4]
89+
Add file 4
90+
[git-p4: depot-paths = "//depot/": change = 4]
9191
92-
Add file 3
93-
[git-p4: depot-paths = "//depot/": change = 3]
92+
Add file 3
93+
[git-p4: depot-paths = "//depot/": change = 3]
9494
95-
Add file 2
96-
[git-p4: depot-paths = "//depot/": change = 2]
95+
Add file 2
96+
[git-p4: depot-paths = "//depot/": change = 2]
9797
98-
Add file 1
99-
[git-p4: depot-paths = "//depot/": change = 1]
98+
Add file 1
99+
[git-p4: depot-paths = "//depot/": change = 1]
100100
101101
EOF
102102
git log --format=%B >actual &&
@@ -112,14 +112,14 @@ test_expect_success 'Clone repo subdir with all history' '
112112
git init . &&
113113
git p4 clone --use-client-spec --destination="$git" --verbose //depot@all &&
114114
cat >expect <<-\EOF &&
115-
Remove file 3
116-
[git-p4: depot-paths = "//depot/": change = 5]
115+
Remove file 3
116+
[git-p4: depot-paths = "//depot/": change = 5]
117117
118-
Add file 3
119-
[git-p4: depot-paths = "//depot/": change = 3]
118+
Add file 3
119+
[git-p4: depot-paths = "//depot/": change = 3]
120120
121-
Add file 1
122-
[git-p4: depot-paths = "//depot/": change = 1]
121+
Add file 1
122+
[git-p4: depot-paths = "//depot/": change = 1]
123123
124124
EOF
125125
git log --format=%B >actual &&

0 commit comments

Comments
 (0)