Merge branch 'cb/maint-orphan-merge-noclobber'
[git/kirr.git] / t / t7101-reset.sh
blob96e163f084f471ea75e6d5b927a5edc6462e54d4
1 #!/bin/sh
3 # Copyright (c) 2006 Shawn Pearce
6 test_description='git reset should cull empty subdirs'
7 . ./test-lib.sh
9 test_expect_success \
10 'creating initial files' \
11 'mkdir path0 &&
12 cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
13 git add path0/COPYING &&
14 git commit -m add -a'
16 test_expect_success \
17 'creating second files' \
18 'mkdir path1 &&
19 mkdir path1/path2 &&
20 cp "$TEST_DIRECTORY"/../COPYING path1/path2/COPYING &&
21 cp "$TEST_DIRECTORY"/../COPYING path1/COPYING &&
22 cp "$TEST_DIRECTORY"/../COPYING COPYING &&
23 cp "$TEST_DIRECTORY"/../COPYING 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'
30 test_expect_success \
31 'resetting tree HEAD^' \
32 'git reset --hard HEAD^'
34 test_expect_success \
35 'checking initial files exist after rewind' \
36 'test -d path0 &&
37 test -f path0/COPYING'
39 test_expect_success \
40 'checking lack of path1/path2/COPYING' \
41 '! test -f path1/path2/COPYING'
43 test_expect_success \
44 'checking lack of path1/COPYING' \
45 '! test -f path1/COPYING'
47 test_expect_success \
48 'checking lack of COPYING' \
49 '! test -f COPYING'
51 test_expect_success \
52 'checking checking lack of path1/COPYING-TOO' \
53 '! test -f path0/COPYING-TOO'
55 test_expect_success \
56 'checking lack of path1/path2' \
57 '! test -d path1/path2'
59 test_expect_success \
60 'checking lack of path1' \
61 '! test -d path1'
63 test_done