2006-02-17 07:26:16 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2006 Shawn Pearce
|
|
|
|
#
|
|
|
|
|
2008-09-03 08:59:31 +00:00
|
|
|
test_description='git reset should cull empty subdirs'
|
2006-02-17 07:26:16 +00:00
|
|
|
. ./test-lib.sh
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'creating initial files' \
|
|
|
|
'mkdir path0 &&
|
2008-08-08 09:26:28 +00:00
|
|
|
cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
|
2007-07-03 05:52:14 +00:00
|
|
|
git add path0/COPYING &&
|
2008-09-03 08:59:31 +00:00
|
|
|
git commit -m add -a'
|
2006-02-17 07:26:16 +00:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'creating second files' \
|
|
|
|
'mkdir path1 &&
|
|
|
|
mkdir path1/path2 &&
|
2008-08-08 09:26:28 +00:00
|
|
|
cp "$TEST_DIRECTORY"/../COPYING path1/path2/COPYING &&
|
|
|
|
cp "$TEST_DIRECTORY"/../COPYING path1/COPYING &&
|
|
|
|
cp "$TEST_DIRECTORY"/../COPYING COPYING &&
|
|
|
|
cp "$TEST_DIRECTORY"/../COPYING path0/COPYING-TOO &&
|
2007-07-03 05:52:14 +00:00
|
|
|
git add path1/path2/COPYING &&
|
|
|
|
git add path1/COPYING &&
|
|
|
|
git add COPYING &&
|
|
|
|
git add path0/COPYING-TOO &&
|
2008-09-03 08:59:31 +00:00
|
|
|
git commit -m change -a'
|
2006-02-17 07:26:16 +00:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'resetting tree HEAD^' \
|
2008-09-03 08:59:31 +00:00
|
|
|
'git reset --hard HEAD^'
|
2006-02-17 07:26:16 +00:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'checking initial files exist after rewind' \
|
|
|
|
'test -d path0 &&
|
|
|
|
test -f path0/COPYING'
|
|
|
|
|
2008-02-01 09:50:53 +00:00
|
|
|
test_expect_success \
|
2006-02-17 07:26:16 +00:00
|
|
|
'checking lack of path1/path2/COPYING' \
|
2008-02-01 09:50:53 +00:00
|
|
|
'! test -f path1/path2/COPYING'
|
2006-02-17 07:26:16 +00:00
|
|
|
|
2008-02-01 09:50:53 +00:00
|
|
|
test_expect_success \
|
2006-02-17 07:26:16 +00:00
|
|
|
'checking lack of path1/COPYING' \
|
2008-02-01 09:50:53 +00:00
|
|
|
'! test -f path1/COPYING'
|
2006-02-17 07:26:16 +00:00
|
|
|
|
2008-02-01 09:50:53 +00:00
|
|
|
test_expect_success \
|
2006-02-17 07:26:16 +00:00
|
|
|
'checking lack of COPYING' \
|
2008-02-01 09:50:53 +00:00
|
|
|
'! test -f COPYING'
|
2006-02-17 07:26:16 +00:00
|
|
|
|
2008-02-01 09:50:53 +00:00
|
|
|
test_expect_success \
|
2006-02-17 07:26:16 +00:00
|
|
|
'checking checking lack of path1/COPYING-TOO' \
|
2008-02-01 09:50:53 +00:00
|
|
|
'! test -f path0/COPYING-TOO'
|
2006-02-17 07:26:16 +00:00
|
|
|
|
2008-02-01 09:50:53 +00:00
|
|
|
test_expect_success \
|
2006-02-17 07:26:16 +00:00
|
|
|
'checking lack of path1/path2' \
|
2008-02-01 09:50:53 +00:00
|
|
|
'! test -d path1/path2'
|
2006-02-17 07:26:16 +00:00
|
|
|
|
2008-02-01 09:50:53 +00:00
|
|
|
test_expect_success \
|
2006-02-17 07:26:16 +00:00
|
|
|
'checking lack of path1' \
|
2008-02-01 09:50:53 +00:00
|
|
|
'! test -d path1'
|
2006-02-17 07:26:16 +00:00
|
|
|
|
|
|
|
test_done
|