git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Lars Hjemli <hjemli@gmail.com>
To: Julius Plenz <plenz@cis.fu-berlin.de>
Cc: Nguyen Thai Ngoc Duy <pclouds@gmail.com>,
	git@vger.kernel.org, cgit@hjemli.net
Subject: Re: [PATCH] clean cached refs when calling set_git_dir()
Date: Thu, 10 Mar 2011 18:14:17 +0100	[thread overview]
Message-ID: <AANLkTikrTva2KFxh0O=Ryn1zWZR2rjCSVkGjHQ0w0xL0@mail.gmail.com> (raw)
In-Reply-To: <20110310160948.GL15960@plenz.com>

On Thu, Mar 10, 2011 at 17:09, Julius Plenz <plenz@cis.fu-berlin.de> wrote:
> * Nguyen Thai Ngoc Duy <pclouds@gmail.com> [2011-03-10 17:00]:
>> On Thu, Mar 10, 2011 at 10:19 PM, Julius Plenz <plenz@cis.fu-berlin.de> wrote:
>> > If you use libgit.a to perform reference resolutions on two or more
>> > repositories that contain packed refs, cached_refs will store the packed
>> > refs for the first repository to contain a packed-refs file only.
>>
>> If you use libgit.a to do anything on more than one repository, you
>> get a lot more messed up that just that. Spawning a new process or
>> accessing with libgit2 may be safer. Why do you want to do that in the
>> first place?
>
> I was working on the cgit repository browser, where you have to peek
> into several repositories to create the overview page. Since cgit
> links to libgit.a I fixed the bug there. Not sure if that's the proper
> way to do it, though...

I never got around to answer your earlier email about this, but here
is what I would have said ;)

Since libgit.a doesn't work with multiple repos [1], cgit supports the
use of an "agefile" (that's the option name in cgitrc) to obtain the
last commit-date per repo.

The content of such an agefile can be generated by a command like the
following in one (or more) of your git hooks:

  git for-each-ref --sort=-authordate --format='%(authordate:iso8601)' --count=1

Hth.
-- 
larsh

[1] Even if libgit.a did support working with multiple repos in a
single run, I probably would avoid this particular usage since it is
bound to perform badly when lots of repos are involved (like on
cgit.freedesktop.org), and even more so when the list is sorted by
idle-time. Simply reading a small textfile per repo is much faster.

      reply	other threads:[~2011-03-10 17:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-10 15:19 [PATCH] clean cached refs when calling set_git_dir() Julius Plenz
2011-03-10 15:59 ` Nguyen Thai Ngoc Duy
2011-03-10 16:09   ` Julius Plenz
2011-03-10 17:14     ` Lars Hjemli [this message]

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='AANLkTikrTva2KFxh0O=Ryn1zWZR2rjCSVkGjHQ0w0xL0@mail.gmail.com' \
    --to=hjemli@gmail.com \
    --cc=cgit@hjemli.net \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    --cc=plenz@cis.fu-berlin.de \
    /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).