Re: [PATCH] fetch: add config to avoid fetching every branch in shallow repo
flat view
From: Harald Nordgren <hidden>
Date: 2026-09-21 21:46:24
On Mon, Sep 21, 2026 at 3:28 PM Phillip Wood [off-list ref] wrote:
Hi Harald On 19/09/2026 15:47, Harald Nordgren via GitGitGadget wrote:quoted
From: Harald Nordgren <redacted> In a shallow, sparsely checked out clone of a repository with many branches, plain git pull can take minutes or hang outright, even though only one branch is actually being worked on.I think the sparse checkout is irrelevant? It is unclear to me if this is talking about a case where there are many branches in the remote repository and only one of them was cloned, then adding a second remote created a wildcard fetch refspec
Yeah likely. I cloned my fork of homebrew-core with `--depth=1` and then added real upstream as a remote. Then I made my work on a feature branch. Then tried to set my branch to track upstream, but it didn't work. Then 'git pull' and it hung.
If it is the former then we should think how we can improve the behavior of "git remote add" in a sparse repository to prevent it adding a wildcard fetch refspec and instead setup the new remote to fetch only the branch(es) we're interested in.
I didn't even consider that, that sounds like an interesting idea! Harald