]> Kevux Git Server - rit/commit
index-pack --promisor: also check commits' trees
authorJonathan Tan <jonathantanmy@google.com>
Tue, 3 Dec 2024 21:52:56 +0000 (13:52 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 9 Dec 2024 23:53:59 +0000 (08:53 +0900)
commit1a14c857dbac02715725e8abcff35266c4c5ac93
treee75e8e74b016adcf16416150eb00b6bc10af1c7a
parent36198026d85848119a8eeb9286d10e795a9e0461
index-pack --promisor: also check commits' trees

Commit c08589efdc (index-pack: repack local links into promisor packs,
2024-11-01) seems to contain an oversight in that the tree of a commit
is not checked. Teach git to check these trees.

The fix slows down a fetch from a certain repo at $DAYJOB from 2m2.127s
to 2m45.052s, but in order to make the fetch correct, it seems worth it.

In order to test this, we could create server and client repos as
follows...

 C   S
  \ /
   O

(O and C are commits both on the client and server. S is a commit
only on the server. C and S have the same tree but different commit
messages. The diff between O and C is non-zero.)

...and then, from the client, fetch S from the server.

In theory, the client declares "have C" and the server can use this
information to exclude S's tree (since it knows that the client has C's
tree, which is the same as S's tree). However, it is also possible for
the server to compute that it needs to send S and not O, and proceed
from there; therefore the objects of C are not considered at all when
determining what to send in the packfile. In order to prevent a test of
client functionality from having such a dependence on server behavior, I
have not included such a test.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/index-pack.c