Re: --shallow-exclude=ref -> "ambiguous deepen-not" error
- From
- Erik Cervin Edin <erik@cervined.in>
- Date
- Oct 21, 2025, 12:08 UTC
- Message-ID
- <CA+JQ7M9svLSV_CSu9OK8hO7rj3GtMQA953tTP=AOta40JTCNCQ@mail.gmail.com>
- In-Reply-To
- <CABPp-BFxqJt+2HbY+d_qdZ0w=UDaL_u4MzO_3cpPpArQHREBJA@mail.gmail.com>
Hi!
I just wanted to add some personal experiences to this thread.
On Tue, Sep 16, 2025 at 4:58 PM Philipp Hahn <phahn-oss@avm.de> wrote:
Show 8 quoted lines
> > I have a use-case for this, where we use GitLab to run some linters on our > merge requests (MRs): They examine the commits since the fork-point "E", for > which they need access to the commits + trees + blobs. Some MRs are larger, > some smaller, so there is no fixed maximum depth I can give to `--depth X` and > be sure to have gotten all commits. > Same for `--shallow-since=` as some are dormant for a year and many other MRs > by-pass them.
I have a very similar use-case to Philipp. Except my forge is GitHub and not quite the same challenges w. temporary merge commits. Basically we run commitlinter on origin/master..HEAD in each PR. The GitHub action does a shallow clone with depth=1 and it looks like commitlinter uses git log under the hood, and as a consequence ends up only running the linter on HEAD. I found --shallow-exclude and thought I would give that a try (to make sure we have the commits origin/master..HEAD). However I encounter a different issue when running the command
# Test 1: shallow-exclude=master FAILS cd /tmp git clone --depth=1 https://github.com/git/git.git test-master cd test-master git rev-list --count --all # Shows: 1 commit git fetch --shallow-exclude=master origin # Result: fatal: the remote end hung up unexpectedly ❌
# Test 2: shallow-exclude=maint WORKS cd /tmp git clone --depth=1 https://github.com/git/git.git test-maint cd test-maint git rev-list --count --all # Shows: 1 commit git fetch --shallow-exclude=maint origin # Result: SUCCESS, now has 43 commits ✅
Originally I thought deepen-not wasn't supported by the GitHub server but I was very surprised seeing it work for maint. No idea of what's going wrong here actually. Some searches pointed in the direction of changing the postBuffer configuration (which seems odd).
I'll probably go a different route but I wanted to share my experiences in the thread as there was not a lot of information around which helped me understand what was going wrong.