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