From: D. Ben Knoble Date: Sun, 20 Sep 2026 21:59:59 GMT Subject: Re: [PATCH] object-name: explain why ~N fails in a shallow clone Message-ID: In-Reply-To: [This is not a complete review, just something I noticed] On Sun, Sep 20, 2026 at 5:55 AM Harald Nordgren via GitGitGadget wrote: > > From: Harald Nordgren > > Asking for a commit's ancestor with ~N or ^N in a shallow > clone that does not have N commits of history locally fails with a > bare "is not a commit" error, with no indication that the repository > being shallow is the reason, or what to do about it. > > Add a hint, shown when the walk runs out of parents exactly at a > recorded shallow boundary, explaining that history was intentionally > truncated there. When looks like / and > is configured, the suggested command names that remote and branch > directly. Here, we mention the most common "ref" cases directly, and it might make sense to restrict this feature only to the use of refs (since we might need such a ref to unshallow via fetch?). > For ~N it suggests the exact --deepen needed, > accounting for any history already present instead of just N. For > ^N the suggestion is always --deepen=1, regardless of N: But here… > diff --git a/Documentation/config/advice.adoc b/Documentation/config/advice.adoc > index 81f80a9274..5b44037fff 100644 > --- a/Documentation/config/advice.adoc > +++ b/Documentation/config/advice.adoc > @@ -128,6 +128,10 @@ all advice messages. > give directions on how to proceed from the current state. > sequencerInUse:: > Shown when a sequencer command is already in progress. > + shallowHistory:: > + Shown when `~` or `^` cannot resolve enough ancestors > + because history stops at a shallow boundary, to suggest > + fetching more history. > skippedCherryPicks:: > Shown when linkgit:git-rebase[1] skips a commit that has already > been cherry-picked onto the upstream branch. …and here, it's not clear to me what kinds of things trigger the hint. The "~N" and "^N" syntax work with any commit-ish, after all! Either way, the hint documentation should probably not show "bare" "~N"/~^N", since that's not syntax accepted by Git. The gitrevisions(7) manual uses "~" and "^[]". Perhaps you meant "rev" instead of "ref" in the commit message? Hm. -- D. Ben Knoble