-
Notifications
You must be signed in to change notification settings - Fork 7
/
test5.sh
executable file
·50 lines (42 loc) · 1.45 KB
/
test5.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only
# GitBSLR is available under the same license as Git itself.
cd $(dirname $0)
. ./testlib.sh
#This script tests symlinks to not-yet-existing targets.
mkdir test/repo/
mkdir test/repo/b/
mkdir test/repo/c/
mkdir test/repo/d/
echo test > test/inaccessible
ln_sr test/repo/c/b test/repo/a
ln_sr test/repo/c/b test/repo/b/a
ln_sr test/repo/c/b test/repo/b/b
ln_sr test/repo/c/b test/repo/b/c
ln_sr test/repo/c/b test/repo/c/a
echo test > test/repo/c/b
ln_sr test/repo/c/b test/repo/c/c
ln_sr test/repo/c/b test/repo/d/a
ln_sr test/repo/c/b test/repo/d/b
ln_sr test/repo/c/b test/repo/d/c
ln_sr test/repo/c/b test/repo/e
ln -s ../output/c/b test/repo/fFAIL
ln_sr test/inaccessible test/repo/gFAIL
ln -s ../output/c test/repo/hFAIL
ln -s ../c/../c/b test/repo/c/dFAIL
cd test/repo/
# gitbslr would rewrite the symlinks above, so use original git
git init
git add .
git commit -m test
cd ../../
mkdir test/output/
mv test/repo/.git/ test/output/.git/
cd test/output/
gitbslr checkout -f HEAD || true # parts of this will fail
cd ../../
mv test/output/.git/ test/.git/
tree test/output/ > test/output.log
tree test/repo/ | grep -v FAIL > test/expected.log
diff -U999 test/output.log test/expected.log
echo Test passed