]> git.ipfire.org Git - thirdparty/git.git/blob - t/t7101-reset-empty-subdirs.sh
Merge branch 'jc/sparse-error-for-developer-build'
[thirdparty/git.git] / t / t7101-reset-empty-subdirs.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2006 Shawn Pearce
4 #
5
6 test_description='git reset should cull empty subdirs'
7 . ./test-lib.sh
8
9 test_expect_success 'creating initial files' '
10 mkdir path0 &&
11 cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
12 git add path0/COPYING &&
13 git commit -m add -a
14 '
15
16 test_expect_success 'creating second files' '
17 mkdir path1 &&
18 mkdir path1/path2 &&
19 cp "$TEST_DIRECTORY"/../COPYING path1/path2/COPYING &&
20 cp "$TEST_DIRECTORY"/../COPYING path1/COPYING &&
21 cp "$TEST_DIRECTORY"/../COPYING COPYING &&
22 cp "$TEST_DIRECTORY"/../COPYING path0/COPYING-TOO &&
23 git add path1/path2/COPYING &&
24 git add path1/COPYING &&
25 git add COPYING &&
26 git add path0/COPYING-TOO &&
27 git commit -m change -a
28 '
29
30 test_expect_success 'resetting tree HEAD^' '
31 git reset --hard HEAD^
32 '
33
34 test_expect_success 'checking initial files exist after rewind' '
35 test -d path0 &&
36 test -f path0/COPYING
37 '
38
39 test_expect_success 'checking lack of path1/path2/COPYING' '
40 ! test -f path1/path2/COPYING
41 '
42
43 test_expect_success 'checking lack of path1/COPYING' '
44 ! test -f path1/COPYING
45 '
46
47 test_expect_success 'checking lack of COPYING' '
48 ! test -f COPYING
49 '
50
51 test_expect_success 'checking checking lack of path1/COPYING-TOO' '
52 ! test -f path0/COPYING-TOO
53 '
54
55 test_expect_success 'checking lack of path1/path2' '
56 ! test -d path1/path2
57 '
58
59 test_expect_success 'checking lack of path1' '
60 ! test -d path1
61 '
62
63 test_done