mirror of
https://github.com/git/git.git
synced 2024-12-15 12:53:36 +08:00
889c6f0e4d
There are many instances where the treatment of symbolic links in the object model and the algorithms are tested, but where it is not necessary to actually have a symbolic link in the worktree. Make adjustments to the tests and remove the SYMLINKS prerequisite when appropriate in trivial cases, where "trivial" means: - merely a replacement of 'ln -s a b && git add b' by test_ln_s_add is needed; - a test for symbolic link on the file system can be split off (and remains protected by SYMLINKS); - existing code is equivalent to test_ln_s_add. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
56 lines
1019 B
Bash
Executable File
56 lines
1019 B
Bash
Executable File
#!/bin/sh
|
|
|
|
test_description='apply to deeper directory without getting fooled with symlink'
|
|
. ./test-lib.sh
|
|
|
|
lecho () {
|
|
for l_
|
|
do
|
|
echo "$l_"
|
|
done
|
|
}
|
|
|
|
test_expect_success setup '
|
|
|
|
mkdir -p arch/i386/boot arch/x86_64 &&
|
|
lecho 1 2 3 4 5 >arch/i386/boot/Makefile &&
|
|
test_ln_s_add ../i386/boot arch/x86_64/boot &&
|
|
git add . &&
|
|
test_tick &&
|
|
git commit -m initial &&
|
|
git branch test &&
|
|
|
|
rm arch/x86_64/boot &&
|
|
mkdir arch/x86_64/boot &&
|
|
lecho 2 3 4 5 6 >arch/x86_64/boot/Makefile &&
|
|
git add . &&
|
|
test_tick &&
|
|
git commit -a -m second &&
|
|
|
|
git format-patch --binary -1 --stdout >test.patch
|
|
|
|
'
|
|
|
|
test_expect_success apply '
|
|
|
|
git checkout test &&
|
|
git diff --exit-code test &&
|
|
git diff --exit-code --cached test &&
|
|
git apply --index test.patch
|
|
|
|
'
|
|
|
|
test_expect_success 'check result' '
|
|
|
|
git diff --exit-code master &&
|
|
git diff --exit-code --cached master &&
|
|
test_tick &&
|
|
git commit -m replay &&
|
|
T1=$(git rev-parse "master^{tree}") &&
|
|
T2=$(git rev-parse "HEAD^{tree}") &&
|
|
test "z$T1" = "z$T2"
|
|
|
|
'
|
|
|
|
test_done
|