mirror of
https://github.com/git/git.git
synced 2024-11-14 13:13:01 +01:00
34110cd4e3
We will always unpack into our own internal index, but we will take the source from wherever specified, and we will optionally write the result to a specified index (optionally, because not everybody even _wants_ any result: the index diffing really wants to just walk the tree and index in parallel). This ends up removing a fair number more lines than it adds, for the simple reason that we can now skip all the crud that tried to be oh-so-careful about maintaining our position in the index as we were traversing and modifying it. Since we don't actually modify the source index any more, we can just update the 'o->pos' pointer without worrying about whether an index entry got removed or replaced or added to. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
30 lines
498 B
Bash
Executable file
30 lines
498 B
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='read-tree -u --reset'
|
|
|
|
. ./test-lib.sh
|
|
|
|
# two-tree test
|
|
|
|
test_expect_success 'setup' '
|
|
git init &&
|
|
mkdir df &&
|
|
echo content >df/file &&
|
|
git add df/file &&
|
|
git commit -m one &&
|
|
git ls-files >expect &&
|
|
rm -rf df &&
|
|
echo content >df &&
|
|
git add df &&
|
|
echo content >new &&
|
|
git add new &&
|
|
git commit -m two
|
|
'
|
|
|
|
test_expect_success 'reset should work' '
|
|
git read-tree -u --reset HEAD^ &&
|
|
git ls-files >actual &&
|
|
diff -u expect actual
|
|
'
|
|
|
|
test_done
|