diff --git a/internal/git/objectpool/fetch.go b/internal/git/objectpool/fetch.go index 4a2cf8d21a30420ac2d9338d1707241f9faef572..87f55e72169555844a3212ad6b8e5448dbef7f8b 100644 --- a/internal/git/objectpool/fetch.go +++ b/internal/git/objectpool/fetch.go @@ -84,9 +84,12 @@ func (o *ObjectPool) FetchFromOrigin(ctx context.Context, origin *gitalypb.Repos refSpec := fmt.Sprintf("+refs/*:%s/*", sourceRefNamespace) fetchCmd, err := git.SafeCmd(ctx, o, nil, git.SubCmd{ - Name: "fetch", - Flags: []git.Option{git.Flag{"--quiet"}}, - Args: []string{sourceRemote, refSpec}, + Name: "fetch", + Flags: []git.Option{ + git.Flag{"--quiet"}, + git.ValueFlag{"--config", "fetch.unpackLimit=1"}, + }, + Args: []string{sourceRemote, refSpec}, }) if err != nil { return err diff --git a/internal/git/receivepack.go b/internal/git/receivepack.go index 4e65e1e1b75a8abd5b8e3c4643331b5989b02350..8369c564511abc4826fa605e493b2a727fcccf79 100644 --- a/internal/git/receivepack.go +++ b/internal/git/receivepack.go @@ -59,5 +59,12 @@ func ReceivePackConfig() []Option { // a commit will be rejected. As this is a mostly harmless // issue, we add the following flag to ignore this check. ValueFlag{"-c", "receive.fsck.badTimezone=ignore"}, + + // If the number of objects received in a push is below this limit then + // the objects will be unpacked into loose object files. + // However if the number of received objects equals or exceeds this limit + // then the received pack will be stored as a pack, after adding any missing delta bases. + // Therefore, we set this to 1 to always store the packs receive from client as-is. + ValueFlag{"-c", "receive.unpackLimit=1"}, } }