git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] fetch: do not look for submodule changes in unchanged refs

From
Orgad Shaneh via GitGitGadget <gitgitgadget@gmail.com>
Date
Sep 2, 2020, 14:23 UTC
Message-ID
<pull.720.git.1599056635276.gitgitgadget@gmail.com>
From: Orgad Shaneh <orgads@gmail.com>

This operation is very expensive, as it scans all the refs using setup_revisions, which resolves each ref, including checking if it is ambiguous, or if it is a file name etc.

There is no reason to do all that for refs that haven't changed in this fetch.

Reported here: https://public-inbox.org/git/CAGHpTBKSUJzFSWc=uznSu2zB33qCSmKXM-iAjxRCpqNK5bnhRg@mail.gmail.com/

Amends commit be76c2128234d94b47f7087152ee55d08bb65d88.
Signed-off-by: Orgad Shaneh <orgads@gmail.com>
---
    fetch: do not look for submodule changes in unchanged refs
    
    This operation is very expensive, as it scans all the refs using
    setup_revisions, which resolves each ref, including checking if it is
    ambiguous, or if it is a file name etc.
    
    There is no reason to do all that for refs that hasn't changed in this
    fetch.
    
    Reported here:
    https://public-inbox.org/git/CAGHpTBKSUJzFSWc=uznSu2zB33qCSmKXM-iAjxRCpqNK5bnhRg@mail.gmail.com/
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-720%2Forgads%2Ffetch-less-submodules-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-720/orgads/fetch-less-submodules-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/720
 builtin/fetch.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 0f23dd4b8c..d3f922fc89 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -958,8 +958,10 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
 				ref->force = rm->peer_ref->force;
 			}
 
-			if (recurse_submodules != RECURSE_SUBMODULES_OFF)
+			if (recurse_submodules != RECURSE_SUBMODULES_OFF &&
+			    (!rm->peer_ref || !oideq(&ref->old_oid, &ref->new_oid))) {
 				check_for_new_submodule_commits(&rm->old_oid);
+			}
 
 			if (!strcmp(rm->name, "HEAD")) {
 				kind = "";

base-commit: e19713638985533ce461db072b49112da5bd2042
-- 
gitgitgadget
Next: Junio C Hamano
Message 1 of 4 in “fetch: do not look for submodule changes in unchanged refs”
  1. fetch: do not look for submodule changes in unchanged refsOrgad Shaneh via GitGitGadget, Sep 2, 2020
  2. Junio C HamanoSep 2, 2020
  3. Orgad ShanehSep 7, 2020
  4. fetch: do not look for submodule changes in unchanged refsOrgad Shaneh via GitGitGadget, Sep 4, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.