summaryrefslogtreecommitdiffstats
path: root/send-pack.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2014-12-24 23:05:40 +0000
committerJunio C Hamano <gitster@pobox.com>2014-12-29 09:58:25 -0800
commit2dacf26d0985521c0f30e535963a45257b63ea21 (patch)
tree8453e46f21fee7805fc7c59a3f365bceac8195ac /send-pack.c
parent1684c1b219e02c91655ad929f752f4f864c72faf (diff)
downloadgit-2dacf26d0985521c0f30e535963a45257b63ea21.tar.gz
git-2dacf26d0985521c0f30e535963a45257b63ea21.tar.xz
pack-objects: use --objects-edge-aggressive for shallow repos
When fetching into or pushing from a shallow repository, we want to aggressively mark edges as uninteresting, since this decreases the pack size. However, aggressively marking edges can negatively affect performance on large non-shallow repositories with lots of refs. Teach pack-objects a --shallow option to indicate that we're pushing from or fetching into a shallow repository. Use --objects-edge-aggressive only for shallow repositories and otherwise use --objects-edge, which performs better in the general case. Update the callers to pass the --shallow option when they are dealing with a shallow repository. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'send-pack.c')
-rw-r--r--send-pack.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/send-pack.c b/send-pack.c
index 949cb61aa..25947d7df 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -47,6 +47,7 @@ static int pack_objects(int fd, struct ref *refs, struct sha1_array *extra, stru
NULL,
NULL,
NULL,
+ NULL,
};
struct child_process po = CHILD_PROCESS_INIT;
int i;
@@ -60,6 +61,8 @@ static int pack_objects(int fd, struct ref *refs, struct sha1_array *extra, stru
argv[i++] = "-q";
if (args->progress)
argv[i++] = "--progress";
+ if (is_repository_shallow())
+ argv[i++] = "--shallow";
po.argv = argv;
po.in = -1;
po.out = args->stateless_rpc ? -1 : fd;