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