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

Re: [PATCH 1/1] revision: don't set parents as uninteresting if exclude promisor objects

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 2, 2024, 16:45 UTC
Message-ID
<xmqq4j82euvr.fsf@gitster.g>
In-Reply-To
<20240802073143.56731-2-hanyang.tony@bytedance.com>
Han Young <hanyang.tony@bytedance.com> writes:
> In revision.c, `process_parents()` recursively marks commit parents 
> as UNINTERESTING if the commit itself is UNINTERESTING.
Makes sense.
> `--exclude-promisor-objects` is implemented as 
> "iterate all objects in promisor packfiles, mark them as UNINTERESTING".
Also makes sense.
> So when we find a commit object in a promisor packfile, we also set its ancestors 
> as UNINTERESTING, whether the ancestor is a promisor object or not.
> This causes normal objects to be falsely marked as promisor objects 
> and removed by `git repack`.

Ahh, that is not desirable. So the need to do something to fix it is well established here.

> Signed-off-by: Han Young <hanyang.tony@bytedance.com>
> Helped-by: C O Xing Xin <xingxin.xx@bytedance.com>
> ---

Please order these trailer lines logically in chronological order, i.e. you get helped by others to complete the change and then seal it by signing it off at the end. I'll swap these two while queuing.

Show 13 quoted lines
> diff --git a/revision.c b/revision.c
> index 1c0192f522..eacb0c909d 100644
> --- a/revision.c
> +++ b/revision.c
> @@ -1164,7 +1164,7 @@ static int process_parents(struct rev_info *revs, struct commit *commit,
>  	 * wasn't uninteresting), in which case we need
>  	 * to mark its parents recursively too..
>  	 */
> -	if (commit->object.flags & UNINTERESTING) {
> +	if (!revs->exclude_promisor_objects && commit->object.flags & UNINTERESTING) {
>  		while (parent) {
>  			struct commit *p = parent->item;
>  			parent = parent->next;

But if the iteration is over all objects in certain packfiles to mark them all uninteresting, shouldn't the caller avoid the call to process_parents() in the first place? Letting process_parents() to do other things and only refrain from doing the "this commit is marked uninteresting" part does not quite match what you are trying to do, at least to me.

Please check "git blame" to find those who are likely to know better about the code around the area and ask for help from them. I think the bulk of the logic related came from the series that led to f3d618d2 (Merge branch 'jh/fsck-promisors', 2018-02-13), so I added the authors of the series.

It apepars to me that its approach to exclude the objects that appear in the promisor packs may be sound, but the design and implementation of it is dubious. Shouldn't it be getting the list of objects with get_object_list() WITHOUT paying any attention to --exclude-promisor-objects flag, and then filtering objects that appear in the promisor packs out of that list, without mucking with the object and commit traversal in revision.c at all?

Thanks.
Previous: Han YoungNext: 韩仰
Message 3 of 65 in “revision: fix reachable objects being gc'ed in no blob clone repo”
  1. 0/1 revision: fix reachable objects being gc'ed in no blob clone repoHan Young, Aug 2, 2024
  2. 1/1 revision: don't set parents as uninteresting if exclude promisor objectsHan Young, Aug 2, 2024
  3. Junio C HamanoAug 2, 2024
  4. 韩仰Aug 12, 2024
  5. Junio C HamanoAug 12, 2024
  6. 韩仰Aug 22, 2024
  7. Jonathan TanAug 13, 2024
  8. Jonathan TanAug 13, 2024
  9. Junio C HamanoAug 14, 2024
  10. Jonathan TanAug 14, 2024
  11. 0/4 revision: fix reachable objects being gc'ed in no blob clone repoHan Young, Aug 23, 2024
  12. 1/4 packfile: split promisor objects oidset into twoHan Young, Aug 23, 2024
  13. 2/4 revision: add exclude-promisor-pack-objects optionHan Young, Aug 23, 2024
  14. 3/4 revision: don't mark commit as UNINTERESTING if --exclude-promisor-objects is setHan Young, Aug 23, 2024
  15. 4/4 repack: use new exclude promisor pack objects optionHan Young, Aug 23, 2024
  16. 0/2 revision: fix reachable commits being gc'ed in partial repoCalvin Wan, Sep 19, 2024
  17. 1/2 packfile: split promisor objects oidset into twoCalvin Wan, Sep 19, 2024
  18. Junio C HamanoSep 22, 2024
  19. 2/2 fetch-pack.c: do not declare local commits as "have" in partial reposCalvin Wan, Sep 19, 2024
  20. Junio C HamanoSep 22, 2024
  21. Junio C HamanoSep 22, 2024
  22. 韩仰Sep 23, 2024
  23. Junio C HamanoSep 23, 2024
  24. Calvin WanOct 2, 2024
  25. 0/2 repack: pack everything into promisor packfile in partial reposHan Young, Sep 25, 2024
  26. 1/2 repack: pack everything into packfileHan Young, Sep 25, 2024
  27. 2/2 t0410: adapt tests to repack changesHan Young, Sep 25, 2024
  28. Phillip WoodSep 25, 2024
  29. Junio C HamanoSep 25, 2024
  30. Junio C HamanoSep 25, 2024
  31. Missing Promisor Objects in Partial Repo Design DocCalvin Wan, Oct 1, 2024
  32. Junio C HamanoOct 1, 2024
  33. Junio C HamanoOct 2, 2024
  34. Han YoungOct 2, 2024
  35. Calvin WanOct 8, 2024
  36. Han YoungOct 9, 2024
  37. Jonathan TanOct 9, 2024
  38. Jonathan TanOct 12, 2024
  39. Han YoungOct 12, 2024
  40. Jonathan TanOct 14, 2024
  41. Jonathan TanOct 9, 2024
  42. 0/3 repack: pack everything into promisor packfile in partial reposHan Young, Oct 8, 2024
  43. 1/3 repack: pack everything into packfileHan Young, Oct 8, 2024
  44. Calvin WanOct 8, 2024
  45. 2/3 t0410: adapt tests to repack changesHan Young, Oct 8, 2024
  46. 3/3 partial-clone: update docHan Young, Oct 8, 2024
  47. Junio C HamanoOct 8, 2024
  48. Junio C HamanoOct 8, 2024
  49. Han YoungOct 9, 2024
  50. 0/3 repack: pack everything into promisor packfile in partial reposHan Young, Oct 11, 2024
  51. 1/3 repack: pack everything into packfileHan Young, Oct 11, 2024
  52. 2/3 repack: adapt tests to repack changesHan Young, Oct 11, 2024
  53. 3/3 partial-clone: update docHan Young, Oct 11, 2024
  54. Junio C HamanoOct 11, 2024
  55. Junio C HamanoOct 11, 2024
  56. 0/3 repack: pack everything into promisor packfile in partial reposHan Young, Oct 14, 2024
  57. 1/3 repack: pack everything into packfileHan Young, Oct 14, 2024
  58. 2/3 t0410: adapt tests to repack changesHan Young, Oct 14, 2024
  59. 3/3 partial-clone: update docHan Young, Oct 14, 2024
  60. 0/3 Repack on fetchJonathan Tan, Oct 21, 2024
  61. 1/3 move variableJonathan Tan, Oct 21, 2024
  62. 2/3 pack-objectsJonathan Tan, Oct 21, 2024
  63. 3/3 record local links and call pack-objectsJonathan Tan, Oct 21, 2024
  64. Han YoungOct 23, 2024
  65. Jonathan TanOct 23, 2024

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.