mirror of
https://github.com/git/git
synced 2024-08-24 18:26:02 +00:00
![Linus Torvalds](/assets/img/avatar_default.png)
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>
31 lines
498 B
Bash
Executable file
31 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
|