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

[PATCH v5 0/2] gc: introduce `gc.recentObjectsHook`

From
Taylor Blau <me@ttaylorr.com>
Date
Jun 7, 2023, 22:58 UTC
Message-ID
<cover.1686178684.git.me@ttaylorr.com>
In-Reply-To
<cover.1683847221.git.me@ttaylorr.com>

Here is a version of my series to implement the mutli-valued "gc.recentObjectHook" configuration, which allows users to define custom programs whose output determines an additional set of objects to retain (along with their descendants) when GCing, regardless of their true age.

It is largely the same as the previous round, with the following changes:

  - a small handful of wordsmithing changes in the second patch's
    message thanks to a very helpful review from the Google team's
    "Review Club" meeting.
  - removed a pair of stray references to "cruft tips" in favor of
    "recent objects".
  - rebased onto v2.41.0

Based on previous rounds of review, I think that this version should be pretty much ready to go. But I'd appreciate some extra eyes on it just to make sure.

Thanks in advance for your (hopefully final!) review.
Taylor Blau (2):
  reachable.c: extract `obj_is_recent()`
  gc: introduce `gc.recentObjectsHook`
 Documentation/config/gc.txt          |  15 +++
 reachable.c                          |  85 ++++++++++++-
 t/t5304-prune.sh                     |  14 +++
 t/t5329-pack-objects-cruft.sh        | 171 +++++++++++++++++++++++++++
 t/t7701-repack-unpack-unreachable.sh |  31 +++++
 5 files changed, 313 insertions(+), 3 deletions(-)
Range-diff against v4:
1:  9c1b59c8cf = 1:  38c4c4a17f reachable.c: extract `obj_is_recent()`
2:  18e50d2517 ! 2:  f661b54941 gc: introduce `gc.recentObjectsHook`
    @@ Commit message
         be pruned. Our options today consist of:
     
           - Point references at the reachability tips of any objects you
    -        consider precious, which may be undesirable or infeasible.
    +        consider precious, which may be undesirable or infeasible if there
    +        are many such objects.
     
           - Track them via the reflog, which may be undesirable since the
             reflog's lifetime is limited to that of the reference it's tracking
    @@ Documentation/config/gc.txt: or rebase occurring.  Since these changes are not p
      default is more aggressive than `gc.reflogExpire`.
      
     +gc.recentObjectsHook::
    -+	When considering the recency of an object (e.g., when generating
    -+	a cruft pack or storing unreachable objects as loose), use the
    -+	shell to execute the specified command(s). Interpret their
    -+	output as object IDs which Git will consider as "recent",
    -+	regardless of their age.
    ++	When considering whether or not to remove an object (either when
    ++	generating a cruft pack or storing unreachable objects as
    ++	loose), use the shell to execute the specified command(s).
    ++	Interpret their output as object IDs which Git will consider as
    ++	"recent", regardless of their age. By treating their mtimes as
    ++	"now", any objects (and their descendants) mentioned in the
    ++	output will be kept regardless of their true age.
     ++
     +Output must contain exactly one hex object ID per line, and nothing
     +else. Objects which cannot be found in the repository are ignored.
    @@ reachable.c: struct recent_data {
     +		ret = run_one_gc_recent_objects_hook(&data->extra_recent_oids,
     +						       programs->items[i].string);
     +		if (ret)
    -+			die(_("unable to enumerate additional cruft tips"));
    ++			die(_("unable to enumerate additional recent objects"));
     +	}
     +}
     +
    @@ t/t5329-pack-objects-cruft.sh: test_expect_success 'cruft objects are freshend v
     +		# ensure that a dirty exit halts cruft pack generation
     +		git config --add gc.recentObjectsHook ./extra-tips.c &&
     +		test_must_fail git repack --cruft --cruft-expiration=now -d 2>err &&
    -+		grep "unable to enumerate additional cruft tips" err &&
    ++		grep "unable to enumerate additional recent objects" err &&
     +
     +		# and that the existing cruft pack is left alone
     +		test_path_is_file "$mtimes"
-- 
2.41.0.2.gaaae24b3a6.dirty
Previous: Taylor BlauNext: Taylor Blau
Message 24 of 28 in “pack-objects: introduce `pack.extraRecentObjectsHook`”
  1. 0/2 pack-objects: introduce `pack.extraRecentObjectsHook`Taylor Blau, May 11, 2023
  2. 1/2 reachable.c: extract `obj_is_recent()`Taylor Blau, May 11, 2023
  3. 2/2 builtin/pack-objects.c: introduce `pack.recentObjectsHook`Taylor Blau, May 11, 2023
  4. Jeff KingMay 12, 2023
  5. Taylor BlauMay 15, 2023
  6. Jeff KingMay 12, 2023
  7. Taylor BlauMay 12, 2023
  8. Jeff KingMay 12, 2023
  9. Jeff KingMay 12, 2023
  10. Jeff KingMay 12, 2023
  11. Junio C HamanoMay 12, 2023
  12. Jeff KingMay 13, 2023
  13. Jeff KingMay 13, 2023
  14. Taylor BlauMay 15, 2023
  15. Taylor BlauMay 15, 2023
  16. Taylor BlauMay 11, 2023
  17. Junio C HamanoMay 11, 2023
  18. Taylor BlauMay 11, 2023
  19. 0/2 gc: introduce `gc.recentObjectsHook`Taylor Blau, May 16, 2023
  20. 1/2 reachable.c: extract `obj_is_recent()`Taylor Blau, May 16, 2023
  21. 2/2 gc: introduce `gc.recentObjectsHook`Taylor Blau, May 16, 2023
  22. Glen ChooMay 24, 2023
  23. Taylor BlauJun 7, 2023
  24. 0/2 gc: introduce `gc.recentObjectsHook`Taylor Blau, Jun 7, 2023
  25. 1/2 reachable.c: extract `obj_is_recent()`Taylor Blau, Jun 7, 2023
  26. 2/2 gc: introduce `gc.recentObjectsHook`Taylor Blau, Jun 7, 2023
  27. Glen ChooJun 9, 2023
  28. Junio C HamanoJun 12, 2023

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.