mirror of
https://github.com/git/git.git
synced 2024-11-17 06:25:13 +01:00
bfdbee9810
Many test scripts assumed that they will start in a 'trash' subdirectory that is a single level down from the t/ directory, and referred to their test vector files by asking for files like "../t9999/expect". This will break if we move the 'trash' subdirectory elsewhere. To solve this, we earlier introduced "$TEST_DIRECTORY" so that they can refer to t/ directory reliably. This finally makes all the tests use it to refer to the outside environment. With this patch, and a one-liner not included here (because it would contradict with what Dscho really wants to do): | diff --git a/t/test-lib.sh b/t/test-lib.sh | index 70ea7e0..60e69e4 100644 | --- a/t/test-lib.sh | +++ b/t/test-lib.sh | @@ -485,7 +485,7 @@ fi | . ../GIT-BUILD-OPTIONS | | # Test repository | -test="trash directory" | +test="trash directory/another level/yet another" | rm -fr "$test" || { | trap - exit | echo >&5 "FATAL: Cannot prepare test area" all the tests still pass, but we would want extra sets of eyeballs on this type of change to really make sure. [jc: with help from Stephan Beyer on http-push tests I do not run myself; credits for locating silly quoting errors go to Olivier Marin.] Signed-off-by: Junio C Hamano <gitster@pobox.com>
60 lines
1.1 KiB
Bash
Executable file
60 lines
1.1 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='difference in submodules'
|
|
|
|
. ./test-lib.sh
|
|
. "$TEST_DIRECTORY"/diff-lib.sh
|
|
|
|
_z40=0000000000000000000000000000000000000000
|
|
test_expect_success setup '
|
|
test_tick &&
|
|
test_create_repo sub &&
|
|
(
|
|
cd sub &&
|
|
echo hello >world &&
|
|
git add world &&
|
|
git commit -m submodule
|
|
) &&
|
|
|
|
test_tick &&
|
|
echo frotz >nitfol &&
|
|
git add nitfol sub &&
|
|
git commit -m superproject &&
|
|
|
|
(
|
|
cd sub &&
|
|
echo goodbye >world &&
|
|
git add world &&
|
|
git commit -m "submodule #2"
|
|
) &&
|
|
|
|
set x $(
|
|
cd sub &&
|
|
git rev-list HEAD
|
|
) &&
|
|
echo ":160000 160000 $3 $_z40 M sub" >expect
|
|
'
|
|
|
|
test_expect_success 'git diff --raw HEAD' '
|
|
git diff --raw --abbrev=40 HEAD >actual &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
test_expect_success 'git diff-index --raw HEAD' '
|
|
git diff-index --raw HEAD >actual.index &&
|
|
test_cmp expect actual.index
|
|
'
|
|
|
|
test_expect_success 'git diff-files --raw' '
|
|
git diff-files --raw >actual.files &&
|
|
test_cmp expect actual.files
|
|
'
|
|
|
|
test_expect_success 'git diff (empty submodule dir)' '
|
|
: >empty &&
|
|
rm -rf sub/* sub/.git &&
|
|
git diff > actual.empty &&
|
|
test_cmp empty actual.empty
|
|
'
|
|
|
|
test_done
|