1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-18 23:14:51 +01:00
git/t/t1008-read-tree-overlay.sh
Jens Lehmann ea5070c91f Teach read-tree the -n|--dry-run option
The option can be used to check if read-tree with the same set of other
options like "-m" and "-u" would succeed without actually changing either
the index or the working tree.

The relevant tests in the t10?? range were extended to do a read-tree -n
before the real read-tree to make sure neither the index nor any local
files were changed with -n and the same exit code as without -n is
returned. The helper functions added for that purpose reside in the new
t/lib-read-tree.sh file.

The only exception is #13 in t1004 ("unlinking an un-unlink-able
symlink"). As this is an issue of wrong directory permissions it is not
detected with -n.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-25 15:04:25 -07:00

32 lines
584 B
Bash
Executable file

#!/bin/sh
test_description='test multi-tree read-tree without merging'
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-read-tree.sh
test_expect_success setup '
echo one >a &&
git add a &&
git commit -m initial &&
git tag initial &&
echo two >b &&
git add b &&
git commit -m second &&
git checkout -b side initial &&
echo three >a &&
mkdir b &&
echo four >b/c &&
git add b/c &&
git commit -m third
'
test_expect_success 'multi-read' '
read_tree_must_succeed initial master side &&
(echo a; echo b/c) >expect &&
git ls-files >actual &&
test_cmp expect actual
'
test_done