git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Push a ref to a remote with many refs
@ 2019-11-19 13:12 Patrick Marlier (pamarlie)
  2019-11-25 16:22 ` Patrick Marlier (pamarlie)
  2019-11-27 12:32 ` [PATCH] send-pack: use OBJECT_INFO_QUICK to check negative objects Jeff King
  0 siblings, 2 replies; 12+ messages in thread
From: Patrick Marlier (pamarlie) @ 2019-11-19 13:12 UTC (permalink / raw)
  To: git

Dear git community,

I am hitting a performance issue with "git push <remote> <refspec>".
The local repository has only few refs and the remote repository has a lot of refs (1000+) with objects unknown to the local repository.

"git push" of only one refspec takes minutes to complete. A quick analysis shows that a lot of time is spent in the client side.
A deeper analysis shows that the client receives the entire list of refs on the remote, then the client is checking in its local repository if the objects exist for all remote refs.
Since the local repository has a only few refs, most of the objects are unknown.
This issue is particularly amplified because the local repository is using many alternates. Indeed for each unknown object, git will try to find in all alternates too.

To workaround this issue, I ended up skipping the refs that are not part of the push. See patch at the end of the message.
Is this safe to do? Is there a better way to do this?

Thanks.
Have a nice day,

Author: Patrick Marlier <pamarlie@cisco.com>
Date:   Tue Aug 6 21:40:48 2019 +0200

    send-pack skip if not part of refspec

diff --git a/send-pack.c b/send-pack.c
index 34c77cbb1a..0fe899f753 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -94,7 +94,7 @@ static int pack_objects(int fd, struct ref *refs, struct oid_array *extra, struc
                feed_object(&extra->oid[i], po_in, 1);
 
        while (refs) {
-               if (!is_null_oid(&refs->old_oid))
+               if (!is_null_oid(&refs->old_oid) && !is_null_oid(&refs->new_oid))
                        feed_object(&refs->old_oid, po_in, 1);
                if (!is_null_oid(&refs->new_oid))
                        feed_object(&refs->new_oid, po_in, 0);

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-12-10 20:27 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-19 13:12 Push a ref to a remote with many refs Patrick Marlier (pamarlie)
2019-11-25 16:22 ` Patrick Marlier (pamarlie)
2019-11-27 12:32 ` [PATCH] send-pack: use OBJECT_INFO_QUICK to check negative objects Jeff King
2019-11-29  9:22   ` Patrick Marlier (pamarlie)
2019-11-30 17:08   ` Junio C Hamano
2019-12-03 23:20     ` Jeff King
2019-12-04 20:53       ` Jonathan Tan
2019-12-04 21:37         ` Junio C Hamano
2019-12-04  3:55   ` Jonathan Nieder
2019-12-04  4:05     ` Jeff King
2019-12-10 16:16       ` Patrick Marlier (pamarlie)
2019-12-10 20:27         ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).