Re: [PATCH] object-name: explain why <ref>~N fails in a shallow clone
From: Junio C Hamano <hidden>
Date: 2026-09-21 23:00:20
Harald Nordgren [off-list ref] writes:
quoted
It is obvious that users would see such a message when they say $ git show HEAD~20 $ git log HEAD~20..HEAD but would they see the same when $ git log -20 HEAD $ git log --since=2.months HEAD and internally HEAD~20 fails to resolve? Should they see the same hint?But I think the 'log -20' doesn't even give an error, so where would we show that message?
Where? To their terminal ;-)? To end users, "git log -20 HEAD" that stops only after showing 2 commits is just as puzzling as, if not more puzzling than, "git show HEAD~20" that complains "What commit are you talking about?" At least the latter has an error message that says the commit the user thought they gave (i.e., HEAD~20) was not interpreted as a commit, and that might give them enough clue to remind them that they are the responsible ones for the unexpected beahviour by initially cloning the repository with a "--depth" option. On the other hand, "git log -20" that stops way before they expect it would does not even give them such a hint. I thought that helping that case would have much more benefit, hence my question.