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

Re: --shallow-exclude=ref -> "ambiguous deepen-not" error

From
EEErik 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.

Previous: Elijah Newren
Message 8 of 8 in “Bug or just a mistake : --shallow-exclude parameter behavior anomalies in Git 2.45.2: "no commits selected" and "ambiguous deepen-not" errors”
  1. bolide2005@163.comFeb 20, 2025
  2. Elijah NewrenFeb 24, 2025
  3. Philipp HahnSep 16, 2025
  4. D. Ben KnobleSep 16, 2025
  5. Philipp HahnSep 16, 2025
  6. Ben KnobleSep 16, 2025
  7. Elijah NewrenSep 17, 2025
  8. Erik Cervin EdinOct 21, 2025

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.