for-each-ref: Do not lookup objects when they will not be used
commitb7dd2d20fad1036ce7da0b635a8bb14cd4230f1a
authorAnders Kaseorg <andersk@MIT.EDU>
Wed, 27 May 2009 19:23:12 +0000 (27 15:23 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 29 May 2009 06:56:19 +0000 (28 23:56 -0700)
tree03de80ea12277743af573f4130192bbc6a4ff185
parente57cb0158209ece040a4b873064504efd7d2ec0e
for-each-ref: Do not lookup objects when they will not be used

This makes commands such as `git for-each-ref --format='%(refname)'`,
which are used heavily by the bash_completion code, run about 6 times
faster on an uncached repository (3 s intead of 18 s on my linux-2.6
repository with several remotes).

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-for-each-ref.c