Merge branch 'ab/make-sparse-for-real'
[git/debian.git] / t / t7101-reset-empty-subdirs.sh
blob5530651eea492cacf106a89a88c261bc101707d7
1 #!/bin/sh
3 # Copyright (c) 2006 Shawn Pearce
6 test_description='git reset should cull empty subdirs'
7 . ./test-lib.sh
8 . "$TEST_DIRECTORY"/lib-diff-data.sh
10 test_expect_success 'creating initial files' '
11 mkdir path0 &&
12 COPYING_test_data >path0/COPYING &&
13 git add path0/COPYING &&
14 git commit -m add -a
17 test_expect_success 'creating second files' '
18 mkdir path1 &&
19 mkdir path1/path2 &&
20 COPYING_test_data >path1/path2/COPYING &&
21 COPYING_test_data >path1/COPYING &&
22 COPYING_test_data >COPYING &&
23 COPYING_test_data >path0/COPYING-TOO &&
24 git add path1/path2/COPYING &&
25 git add path1/COPYING &&
26 git add COPYING &&
27 git add path0/COPYING-TOO &&
28 git commit -m change -a
31 test_expect_success 'resetting tree HEAD^' '
32 git reset --hard HEAD^
35 test_expect_success 'checking initial files exist after rewind' '
36 test -d path0 &&
37 test -f path0/COPYING
40 test_expect_success 'checking lack of path1/path2/COPYING' '
41 ! test -f path1/path2/COPYING
44 test_expect_success 'checking lack of path1/COPYING' '
45 ! test -f path1/COPYING
48 test_expect_success 'checking lack of COPYING' '
49 ! test -f COPYING
52 test_expect_success 'checking checking lack of path1/COPYING-TOO' '
53 ! test -f path0/COPYING-TOO
56 test_expect_success 'checking lack of path1/path2' '
57 ! test -d path1/path2
60 test_expect_success 'checking lack of path1' '
61 ! test -d path1
64 test_done