oneway_merge(): only lstat() when told to update worktree
authorMartin von Zweigbergk <martinvonz@gmail.com>
Thu, 20 Dec 2012 21:03:36 +0000 (13:03 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 20 Dec 2012 21:07:22 +0000 (13:07 -0800)
commit686b2de0ceb2c5a1fb6c8822a8aceb8a05e2fc76
treeb621f7c3d0814d6658c86fa54a0773104e5ec9f3
parent7e2010537e96d0a1144520222f20ba1dc3d61441
oneway_merge(): only lstat() when told to update worktree

Although the subject line of 613f027 (read-tree -u one-way merge fix
to check out locally modified paths., 2006-05-15) mentions "read-tree
-u", it did not seem to check whether -u was in effect. Not checking
whether -u is in effect makes e.g. "read-tree --reset" lstat() the
worktree, even though the worktree stat should not matter for that
operation.

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

        Before      After
real    0m0.288s    0m0.233s
user    0m0.190s    0m0.150s
sys     0m0.090s    0m0.080s

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