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

Re: [PATCH] clean cached refs when calling set_git_dir()

From
LHLars Hjemli <hjemli@gmail.com>
Date
Mar 10, 2011, 17:14 UTC
Message-ID
<AANLkTikrTva2KFxh0O=Ryn1zWZR2rjCSVkGjHQ0w0xL0@mail.gmail.com>
In-Reply-To
<20110310160948.GL15960@plenz.com>
On Thu, Mar 10, 2011 at 17:09, Julius Plenz <plenz@cis.fu-berlin.de> wrote:
Show 15 quoted lines
> * 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.
Previous: Julius Plenz
Message 4 of 4 in “clean cached refs when calling set_git_dir()”
  1. clean cached refs when calling set_git_dir()Julius Plenz, Mar 10, 2011
  2. Nguyen Thai Ngoc DuyMar 10, 2011
  3. Julius PlenzMar 10, 2011
  4. Lars HjemliMar 10, 2011

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.