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

Re: [RFC/PATCH v4 1/2] gitweb: check given hash before trying to create snapshot

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 13, 2009, 05:42 UTC
Message-ID
<7vy6oj1jug.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4AAC8521.1060005@mailservices.uwaterloo.ca>
Mark Rada <marada@uwaterloo.ca> writes:
Show 18 quoted lines
> On 09-09-12 11:30 PM, Junio C Hamano wrote:
>>> @@ -5196,8 +5202,9 @@ sub git_snapshot {
>>>  		die_error(403, "Unsupported snapshot format");
>>>  	}
>>>  
>>> -	if (!defined $hash) {
>>> -		$hash = git_get_head_hash($project);
>>> +	my $full_hash = git_get_full_hash($project, $hash);
>>> +	if (!$full_hash) {
>>> +		die_error(404, 'Hash id was not valid');
>>>  	}
>> 
>> This is in the context of "snapshot", so obviously you care more about
>> just "such an object exists", don't you?  You also want it to be a
>> tree-ish.  Try giving it $hash = 'junio-gpg-pub' and see how it breaks.
>  
> You have confused me. How is using 'junio-gpg-pub' different from the 
> second test case that tries to use 'frizzumFrazzum'?
junio-gpg-pub tag exists in git.git but it tags a blob not a tree.
	$ git rev-parse junio-gpg-pub
        6019c27d966fe3ce8adcc0e9f12078eef96ca6ef
        $ git archive junio-gpg-pub
        fatal: not a tree object
Previous: Mark RadaNext: Jakub Narebski
Message 4 of 5 in “gitweb: check given hash before trying to create snapshot”
  1. 1/2 gitweb: check given hash before trying to create snapshotMark Rada, Sep 13, 2009
  2. Junio C HamanoSep 13, 2009
  3. Mark RadaSep 13, 2009
  4. Junio C HamanoSep 13, 2009
  5. Jakub NarebskiSep 13, 2009

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.