Push a ref to a remote with many refs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
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);




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux