diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-04-10 02:25:43 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-04-10 02:25:43 +0300 |
commit | 5d806b74d5223d0c19afd023fea3b321cc5bc717 (patch) | |
tree | 6976e1d8d39c17aa9102600e72e3ea40e07e1803 /sha1_file.c | |
parent | e4bb62fa1eeee689744b413e29a50b4d1dae6886 (diff) | |
parent | 024aa4696c788eb1b07be53331f770605696ffba (diff) |
Merge branch 'ti/fetch-everything-local-optim'
A "git fetch" from a repository with insane number of refs into a
repository that is already up-to-date still wasted too many cycles
making many lstat(2) calls to see if these objects at the tips
exist as loose objects locally. These lstat(2) calls are optimized
away by enumerating all loose objects beforehand.
It is unknown if the new strategy negatively affects existing use
cases, fetching into a repository with many loose objects from a
repository with small number of refs.
* ti/fetch-everything-local-optim:
fetch-pack.c: use oidset to check existence of loose object
Diffstat (limited to 'sha1_file.c')
-rw-r--r-- | sha1_file.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sha1_file.c b/sha1_file.c index cc0f43ea84..ad77549565 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -1262,6 +1262,9 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi, if (find_pack_entry(real, &e)) break; + if (flags & OBJECT_INFO_IGNORE_LOOSE) + return -1; + /* Most likely it's a loose object. */ if (!sha1_loose_object_info(real, oi, flags)) return 0; |