unpack-trees: avoid the_index in verify_absent()
commitc7f3259d0d343f17848b0135612f61c075c47690
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Mon, 13 Aug 2018 16:14:29 +0000 (13 18:14 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 13 Aug 2018 21:14:43 +0000 (13 14:14 -0700)
tree40ffd2e0e5a446c01a3a28d94ab4731517e52336
parent27c82fb3b406e01bbcd6c7cb11dc1925b88f6a92
unpack-trees: avoid the_index in verify_absent()

Both functions that are updated in this commit are called by
verify_absent(), which is part of the "unpack-trees" operation that is
supposed to work on any index file specified by the caller. Thanks to
Brandon [1] [2], an implicit dependency on the_index is exposed. This
commit fixes it.

In both functions, it makes sense to use src_index to check for
exclusion because it's almost unchanged and should give us the same
outcome as if running the exclude check before the unpack.

It's "almost unchanged" because we do invalidate cache-tree and
untracked cache in the source index. But this should not affect how
exclude machinery uses the index: to see if a file is tracked, and to
read a blob from the index instead of worktree if it's marked
skip-worktree (i.e. it's not available in worktree)

[1] a0bba65b10 (dir: convert is_excluded to take an index - 2017-05-05
[2] 2c1eb10454 (dir: convert read_directory to take an index - 2017-05-05)

Helped-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
unpack-trees.c