git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: Lea Wiemann <lewiemann@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] gitweb: use Git.pm, and use its parse_rev method for git_get_head_hash
Date: Sat, 31 May 2008 02:40:13 -0700 (PDT)	[thread overview]
Message-ID: <m3lk1q24nb.fsf@localhost.localdomain> (raw)
In-Reply-To: <484087A7.2030107@gmail.com>

Lea Wiemann <lewiemann@gmail.com> writes:

> Lea Wiemann wrote:
> > Subject: [PATCH] gitweb: use Git.pm, and use its parse_rev method
> >          for git_get_head_hash
> 
> For clarification, this is my first patch for refactoring Gitweb to
> use Git.pm's API.

Good.

I'm not sure however how much of gitweb engine should be moved to
Git.pm.  I think calling git commands could be moved from git_cmd() to
command_output_pipe() or command_oneline(), replacing global variable
$git_dir by global variable $repo.  Perhaps gitweb's config file
parsing should be added as an option to Git.pm.  But I'm not sure for
example about parsing subroutines.

> In the end, I'm hoping that all (or at least most) of Gitweb's
> accesses to the repositories will go through this API, which allows us
> to add caching to the Git.pm API (rather than Gitweb) pretty easily
> and cleanly.

IMVHO caching command output is bad idea.  I'd rather have gitweb
cache _parsed_ data (i.e. Perl structures).

For example projects list (but also summary page for a project) is
composed as result of parsing output of _many_ git commands, in the
case of projects list coming from many different repositories.
Caching git command output (something like IPC::Cmd::Cached?)
would only repeat bad I/O patterns of git commands.

Also I don't think it is a good idea to pollute Git.pm by caching
command output.  Perhaps in Git::Cached, but as a last resort...

P.S. Here it is what could go to Git.pm:
 * Eager config parsing, using e.g. $repo->parse_config() to prepare
   %config hash, and have $repo->config(VAR) etc. use %config hash.
   This means one git command and not one git command per variable,
   but it also means that we have to convert to bool or int, or color
   in Perl.
 * unquote() (which is not repository instance merhod, but utility
   subroutine) to unquote and unescape filenames.
 * generating rfc2822 and iso-8601 dates from timestamp plus timezone,
   i.e. from author/committer/tagger date; it would be useful for
   example in git-send-email.

I'm not sure about parse_* subroutines (some of which are not generic
enough, I guess).
-- 
Jakub Narebski
Poland
ShadeHawk on #git

  reply	other threads:[~2008-05-31  9:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-30 23:00 [PATCH] gitweb: use Git.pm, and use its parse_rev method for git_get_head_hash Lea Wiemann
2008-05-30 23:03 ` Lea Wiemann
2008-05-31  9:40   ` Jakub Narebski [this message]
2008-05-31 12:39     ` Lea Wiemann
2008-06-01 22:19       ` Jakub Narebski
2008-06-02  5:35         ` Junio C Hamano
2008-06-02  9:29         ` Petr Baudis
2008-06-02 21:32           ` Jakub Narebski
2008-06-02 22:31             ` Lea Wiemann
2008-05-31 13:04 ` Petr Baudis
2008-05-31 14:19   ` [PATCH v2] " Lea Wiemann
2008-05-31 14:34     ` Lea Wiemann
2008-06-01  8:23     ` Junio C Hamano
2008-06-01 15:44       ` Lea Wiemann
2008-06-01 21:33         ` Junio C Hamano
2008-06-01 22:16           ` [PATCH] test-lib.sh: set PERL5LIB instead of GITPERLLIB Lea Wiemann
2008-06-02  5:17             ` Junio C Hamano
2008-06-02 14:08               ` Lea Wiemann
2008-06-02 14:13                 ` [PATCH v2] " Lea Wiemann
2008-06-02 20:01                   ` Junio C Hamano
2008-06-02 22:19                     ` Lea Wiemann
2008-06-03  0:20               ` [PATCH] " Lea Wiemann
2008-06-01 23:18     ` [PATCH v2] gitweb: use Git.pm, and use its parse_rev method for git_get_head_hash Lea Wiemann

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=m3lk1q24nb.fsf@localhost.localdomain \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    --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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).