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

Re: [PATCH] repack: call prune_packed_objects() and update_server_info() directly

From
Jeff King <peff@peff.net>
Date
Sep 13, 2014, 20:15 UTC
Message-ID
<20140913201538.GA24854@peff.net>
In-Reply-To
<5413F201.8030005@web.de>
On Sat, Sep 13, 2014 at 09:28:01AM +0200, René Scharfe wrote:
> Call the functions behind git prune-packed and git update-server-info
> directly instead of using run_command().  This is shorter, easier and
> quicker.

It can also introduce bugs, since a lot of git code assumes it is running in a single process and can die() or mark up global variables at will. :)

I gave a quick read-through of the code and I think these calls are OK. The two things I noticed were:

  1. We might die on a malloc failure that would otherwise go unnoticed
     in a sub-process. That's probably OK.
  2. The info/packs file is generated from our internal packed_git list.
     This list can get crufty if you have a long-running process that
     accesses objects and other processes are repacking. I think that's
     OK here; the parent repack process is not very long-lived.

I did, however, notice that the code we are calling has some problems of its own. :) Here are some fixes:

  [1/3]: prune-packed: fix minor memory leak
  [2/3]: make update-server-info more robust
  [3/3]: server-info: clean up after writing info/packs
-Peff
Previous: Stefan BellerNext: Jeff King
Message 3 of 9 in “repack: call prune_packed_objects() and update_server_info() directly”
  1. repack: call prune_packed_objects() and update_server_info() directlyRené Scharfe, Sep 13, 2014
  2. Stefan BellerSep 13, 2014
  3. Jeff KingSep 13, 2014
  4. 1/3 prune-packed: fix minor memory leakJeff King, Sep 13, 2014
  5. 2/3 make update-server-info more robustJeff King, Sep 13, 2014
  6. René ScharfeSep 14, 2014
  7. Junio C HamanoSep 15, 2014
  8. Jeff KingSep 15, 2014
  9. 3/3 server-info: clean up after writing info/packsJeff King, Sep 13, 2014

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.