From: Mark Rada Date: Sun, 13 Sep 2009 05:37:37 GMT Subject: Re: [RFC/PATCH v4 1/2] gitweb: check given hash before trying to create snapshot Message-ID: <4AAC8521.1060005@mailservices.uwaterloo.ca> In-Reply-To: <7vmy4z4j35.fsf@alter.siamese.dyndns.org> 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'? -- Mark Rada (ferrous26) marada@uwaterloo.ca