diff options
author | Orgad Shaneh <orgads@gmail.com> | 2020-09-06 22:53:55 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-09-06 23:44:41 +0200 |
commit | a462bee5d5b52c9778a9df600494fbd87f3c5fb9 (patch) | |
tree | bacb0cdb65f0489615d1cba1a47b9fad244ec4ff /submodule.c | |
parent | Thirteenth batch (diff) | |
download | git-a462bee5d5b52c9778a9df600494fbd87f3c5fb9.tar.xz git-a462bee5d5b52c9778a9df600494fbd87f3c5fb9.zip |
submodule: suppress checking for file name and ref ambiguity for object ids
The argv argument of collect_changed_submodules() contains only object ids
(the objects references of all the refs).
Notify setup_revisions() that the input is not filenames by passing
assume_dashdash, so it can avoid redundant stat for each ref.
Also suppress refname_ambiguity flag to avoid filesystem lookups for
each object. Similar logic can be found in cat-file, pack-objects and more.
This change reduces the time for git fetch in my repo from 25s to 6s.
Signed-off-by: Orgad Shaneh <orgads@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'submodule.c')
-rw-r--r-- | submodule.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/submodule.c b/submodule.c index 3cbcf40dfc..e48710e423 100644 --- a/submodule.c +++ b/submodule.c @@ -840,9 +840,16 @@ static void collect_changed_submodules(struct repository *r, { struct rev_info rev; const struct commit *commit; + int save_warning; + struct setup_revision_opt s_r_opt = { + .assume_dashdash = 1, + }; + save_warning = warn_on_object_refname_ambiguity; + warn_on_object_refname_ambiguity = 0; repo_init_revisions(r, &rev, NULL); - setup_revisions(argv->nr, argv->v, &rev, NULL); + setup_revisions(argv->nr, argv->v, &rev, &s_r_opt); + warn_on_object_refname_ambiguity = save_warning; if (prepare_revision_walk(&rev)) die(_("revision walk setup failed")); |