Re: [PATCH/RFC] gitweb: Default to $hash_base or HEAD for $hash in "commit" and "commitdiff" views
- From
Jakub Narebski <jnareb@gmail.com>
- Date
- Nov 8, 2006, 22:35 UTC
- Message-ID
- <200611082335.28296.jnareb@gmail.com>
- In-Reply-To
- <7vvelpr34d.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
Show 17 quoted lines
> Jakub Narebski <jnareb@gmail.com> writes: > >> Set $hash parameter to $hash_base || "HEAD" if it is not set (if it is >> not true to be more exact). This allows [hand-edited] URLs with 'action' >> "commit" or "commitdiff" but without 'hash' parameter. >> >> Signed-off-by: Jakub Narebski <jnareb@gmail.com> >> --- >> RFC because I want to ask if we should default to HEAD if hash is not >> provided for commit and commitdiff views, or should we error out with >> more reasonable error message. > > Probably the latter; the user might be hand-crafting a URL > (maybe learned a commit object name from mailing list and > cutting and pasting) and mispasted the long hexadecimal string. > Silently giving HEAD may leave the user confused than "oops, we > do not see that commit object".
No, if there is 'h' (hash) parameter provided, then gitweb tries to use this. HEAD is used _only_ if nether hash, nor hash_base are provided, i.e. for URL like below
URL?p=project.git;a=commit
i.e. without neither 'h' nor 'hb'.
But if it is (it being defaulting to HEAD, _like git_) wrong solution, still it would be better to show 'commit not provided' error instead of current 'bad commit' error.
-- Jakub Narebski