Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 2fa9eca

Browse files
committed
test: Factor out 'check_symlink' for stash tests
Required by msysgit while the msys core does not handle reading NTFS Symbolic-Link Reparse Points. Signed-off-by: Michael Geddes <[email protected]>
1 parent a662ef7 commit 2fa9eca

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

t/t3903-stash.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ test_expect_success SYMLINKS 'stash file to symlink' '
308308
test -f file &&
309309
test bar = "$(cat file)" &&
310310
git stash apply &&
311-
case "$(ls -l file)" in *" file -> file2") :;; *) false;; esac
311+
check_symlink file file2
312312
'
313313

314314
test_expect_success SYMLINKS 'stash file to symlink (stage rm)' '
@@ -319,7 +319,7 @@ test_expect_success SYMLINKS 'stash file to symlink (stage rm)' '
319319
test -f file &&
320320
test bar = "$(cat file)" &&
321321
git stash apply &&
322-
case "$(ls -l file)" in *" file -> file2") :;; *) false;; esac
322+
check_symlink file file2
323323
'
324324

325325
test_expect_success SYMLINKS 'stash file to symlink (full stage)' '
@@ -331,7 +331,7 @@ test_expect_success SYMLINKS 'stash file to symlink (full stage)' '
331331
test -f file &&
332332
test bar = "$(cat file)" &&
333333
git stash apply &&
334-
case "$(ls -l file)" in *" file -> file2") :;; *) false;; esac
334+
check_symlink file file2
335335
'
336336

337337
# This test creates a commit with a symlink used for the following tests
@@ -347,7 +347,7 @@ test_expect_success 'stash symlink to file' '
347347

348348
test_expect_success SYMLINKS 'this must have re-created the symlink' '
349349
test -h filelink &&
350-
case "$(ls -l filelink)" in *" filelink -> file") :;; *) false;; esac
350+
check_symlink filelink file
351351
'
352352

353353
test_expect_success 'unstash must re-create the file' '
@@ -365,7 +365,7 @@ test_expect_success 'stash symlink to file (stage rm)' '
365365

366366
test_expect_success SYMLINKS 'this must have re-created the symlink' '
367367
test -h filelink &&
368-
case "$(ls -l filelink)" in *" filelink -> file") :;; *) false;; esac
368+
check_symlink filelink file
369369
'
370370

371371
test_expect_success 'unstash must re-create the file' '
@@ -384,7 +384,7 @@ test_expect_success 'stash symlink to file (full stage)' '
384384

385385
test_expect_success SYMLINKS 'this must have re-created the symlink' '
386386
test -h filelink &&
387-
case "$(ls -l filelink)" in *" filelink -> file") :;; *) false;; esac
387+
check_symlink filelink file
388388
'
389389

390390
test_expect_success 'unstash must re-create the file' '

t/test-lib.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,10 @@ abspath_of_dir () {
798798
(cd "$1" ; pwd -P)
799799
}
800800

801+
check_symlink() {
802+
case "$(ls -l $1)" in *" $1 -> $2") :;; *) false;; esac
803+
}
804+
801805
# Fix some commands on Windows
802806
case $(uname -s) in
803807
*MINGW*)

0 commit comments

Comments
 (0)