reset $pathspec: no need to discard index
commit10746a361689aaa1aa98b8d4e7fb3b8463391864
authorMartin von Zweigbergk <martinvonz@gmail.com>
Tue, 15 Jan 2013 05:47:33 +0000 (14 21:47 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 15 Jan 2013 17:38:06 +0000 (15 09:38 -0800)
tree02acfb88b6efec2661c858a5ab8d6596d4894e53
parent44fe83502edf5391bb3a5997cab01794b4568062
reset $pathspec: no need to discard index

Since 34110cd (Make 'unpack_trees()' have a separate source and
destination index, 2008-03-06), the index no longer gets clobbered by
do_diff_cache() and we can remove the code for discarding and
re-reading it.

There are two paths to update_index_refresh() from cmd_reset(), but on
both paths, either read_cache() or read_cache_unmerged() will have
been called, so the call to read_cache() in this method is redundant
(although practically free).

This speeds up "git reset -- ." a little on the linux-2.6 repo (best
of five, warm cache):

        Before      After
real    0m0.093s    0m0.080s
user    0m0.040s    0m0.020s
sys     0m0.050s    0m0.050s

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/reset.c