Skip to content

Commit 829b7fc

Browse files
committed
ui-tests: refactor setup into its own function
Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 48d0757 commit 829b7fc

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

ui-tests/background-hook.ahk

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,26 @@
1010
; This was fixed in the Cygwin/MSYS2 runtime, but then regressed again.
1111
; This test is meant to verify that the issue is fixed and remains so.
1212

13-
; First, set the worktree path; This path will be reused
14-
; for the `.log` file).
15-
if A_Args.Length > 0
16-
workTree := A_Args[1]
17-
else
18-
{
19-
; Create a unique worktree path in the TEMP directory.
20-
workTree := EnvGet('TEMP') . '\git-test-background-hook'
21-
if FileExist(workTree)
13+
SetWorkTree() {
14+
global workTree
15+
; First, set the worktree path; This path will be reused
16+
; for the `.log` file).
17+
if A_Args.Length > 0
18+
workTree := A_Args[1]
19+
else
2220
{
23-
counter := 0
24-
while FileExist(workTree '-' counter)
25-
counter++
26-
workTree := workTree '-' counter
21+
; Create a unique worktree path in the TEMP directory.
22+
workTree := EnvGet('TEMP') . '\git-test-background-hook'
23+
if FileExist(workTree)
24+
{
25+
counter := 0
26+
while FileExist(workTree '-' counter)
27+
counter++
28+
workTree := workTree '-' counter
29+
}
2730
}
2831
}
32+
SetWorkTree()
2933

3034
Info(text) {
3135
FileAppend text '`n', workTree '.log'

0 commit comments

Comments
 (0)