Skip to content

Commit d8bc1a5

Browse files
jonathantanmygitster
authored andcommitted
send-pack: never fetch when checking exclusions
When building the packfile to be sent, send_pack() is given a list of remote refs to be used as exclusions. For each ref, it first checks if the ref exists locally, and if it does, passes it with a "^" prefix to pack-objects. However, in a partial clone, the check may trigger a lazy fetch. The additional commit ancestry information obtained during such fetches may show that certain objects that would have been sent are already known to the server, resulting in a smaller pack being sent. But this is at the cost of fetching from many possibly unrelated refs, and the lazy fetches do not help at all in the typical case where the client is up-to-date with the upstream of the branch being pushed. Ensure that these lazy fetches do not occur. Signed-off-by: Jonathan Tan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b744c3a commit d8bc1a5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

send-pack.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ int option_parse_push_signed(const struct option *opt,
4040

4141
static void feed_object(const struct object_id *oid, FILE *fh, int negative)
4242
{
43-
if (negative && !has_object_file(oid))
43+
if (negative &&
44+
!has_object_file_with_flags(oid, OBJECT_INFO_SKIP_FETCH_OBJECT))
4445
return;
4546

4647
if (negative)

0 commit comments

Comments
 (0)