git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: Lea Wiemann <lewiemann@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH] gitweb: return correct HTTP status codes
Date: Wed, 18 Jun 2008 02:12:15 +0200	[thread overview]
Message-ID: <200806180212.15392.jnareb@gmail.com> (raw)
In-Reply-To: <48584D1F.5070000@gmail.com>

Lea Wiemann wrote:
> Jakub Narebski wrote:
> >
> > But what are arguments for "check params; run command" vs "run command;
> > check params if error" proposed by Junio?  Why do you want to check
> > parameters upfront?
> 
> It's actually not checking, it's resolving.  Instead of ...
> 
> get_commit($symbol)
> 
> ... (with $symbol = 'HEAD' for instance), you do (pseudocode):
> 
> $hash = get_hash($symbol, 'commit'); # 'commit' to resolve tags

Errr... is there equivalent to ^{}, i.e. resolve to non-tag?

> check that $hash is defined
> get_commit($hash)

Note that you would have to examine gitweb sources to check if it
uses href(..., -replay=>1) when it should, so the links from "volatile"
link, e.g. HEAD version URL, also lead to appropriate version,
e.g. "tree" from current / HEAD version.

> (And get_commit won't even accept anything but 40-byte hashes.)  This is 
> for two reasons:
> 
> 1. Caching: Resolving symbols first gives you some (very few) cache 
> entries that need to be expired (namely, get_hash results for symbols 
> that are not SHA1 hashes already), but most cache entries (like the 
> get_commit) are infinitely valid.

BTW. one of earliest idea was to fully resolve hashes, add missing
parameters if possible (like 'h', 'hp', 'f') and convert hashes to
sha-1.  One of intended uses was (weak) ETag for simple HTTP caching.

But it was before git-cat-file --batch-check, and before
href(...,-replay=>1).

[...]

Thanks for explanation.  It makes clear why you have chosen this
solution (I think that (1) is deciding factor here).


> > By the way, would you be sending your current WIP for review?
> 
> Will do in the next 2 days after some cleanup.

Thanks.

I have read your current code, but I'd rather not comment on it
(like no_plan and skipping tests, or elaborate wrapping fields
vs. perltie) until it is ready, i.e. sent for peer review.

> > [is] adding object oriented interface (wrapper) to git repositories
> > really  needed for implementing gitweb caching?
> 
> It makes things better to read for sure, and it means that you can have 
> a plain API without caching, and implement the caching layer as a 
> subclass (which overrides the methods with cacheable results).

All the time I think that caching _everything_ is a bad solution.
Besides sometimes you need to cache information specific for gitweb,
or information _aggregated_ by gitweb, which doesn't have place as
single entity in Git::Repo.

So while I think that Git::Repo and making gitweb use it is
a worthwhile goal, I think caching should be explicitely in gitweb.
See CGI::Cache for good solution of inobtrusive output caching, and
CHI (or other in recommended thread) for inobtrusive data caching
using callbacks (and Cache::None engine).  That not said that we
should use such non-standard Perl modules!

<probably should not send email this late>
-- 
Jakub Narebski
Poland

  reply	other threads:[~2008-06-18  0:20 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-15 21:15 [PATCH] gitweb: return correct HTTP status codes Lea Wiemann
2008-06-15 22:48 ` Jakub Narebski
2008-06-16 15:57   ` Lea Wiemann
2008-06-16 16:43     ` Jakub Narebski
2008-06-16 21:49       ` Lea Wiemann
2008-06-16 22:34         ` Jakub Narebski
2008-06-17 13:53           ` Lea Wiemann
2008-06-16 22:38     ` Junio C Hamano
2008-06-17 14:04       ` Lea Wiemann
2008-06-17 14:33         ` Jakub Narebski
2008-06-17 22:28           ` Lea Wiemann
2008-06-17 22:54             ` Jakub Narebski
2008-06-17 23:47               ` Lea Wiemann
2008-06-18  0:12                 ` Jakub Narebski [this message]
2008-06-18  1:25                   ` Lea Wiemann
2008-06-18  7:35                     ` Jakub Narebski
2008-06-16 23:37     ` Jakub Narebski
2008-06-18  0:15 ` [PATCH] gitweb: standarize " Lea Wiemann
2008-06-19  0:51   ` [PATCH v2] " Jakub Narebski
2008-06-19 19:08     ` Lea Wiemann
2008-06-19 20:03       ` [PATCH v3] " Lea Wiemann
2008-06-19 20:25         ` Lea Wiemann
2008-06-19 22:37           ` Jakub Narebski
2008-06-20  0:48         ` Junio C Hamano
2008-06-19 22:22       ` [PATCH v2] " Jakub Narebski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200806180212.15392.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=lewiemann@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).