summaryrefslogtreecommitdiff
path: root/upload-pack.c
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2006-09-26 15:27:39 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-09-27 07:12:00 (GMT)
commite4fe4b8ef7cdde842a9e5e2594d0fba1367d9dd3 (patch)
tree4a5d5a74da17b42637095fa451f3d11c739fe665 /upload-pack.c
parent780e6e735be189097dad4b223d8edeb18cce1928 (diff)
downloadgit-e4fe4b8ef7cdde842a9e5e2594d0fba1367d9dd3.zip
git-e4fe4b8ef7cdde842a9e5e2594d0fba1367d9dd3.tar.gz
git-e4fe4b8ef7cdde842a9e5e2594d0fba1367d9dd3.tar.bz2
let the GIT native protocol use offsets to delta base when possible
There is no reason not to always do this when both ends agree. Therefore a client that can accept offsets to delta base always sends the "ofs-delta" flag. The server will stream a pack with or without offset to delta base depending on whether that flag is provided or not with no additional cost. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'upload-pack.c')
-rw-r--r--upload-pack.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/upload-pack.c b/upload-pack.c
index 189b239..9ec3775 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -16,7 +16,7 @@ static const char upload_pack_usage[] = "git-upload-pack [--strict] [--timeout=n
#define OUR_REF (1U << 1)
#define WANTED (1U << 2)
static int multi_ack, nr_our_refs;
-static int use_thin_pack;
+static int use_thin_pack, use_ofs_delta;
static struct object_array have_obj;
static struct object_array want_obj;
static unsigned int timeout;
@@ -137,7 +137,9 @@ static void create_pack_file(void)
close(pu_pipe[1]);
close(pe_pipe[0]);
close(pe_pipe[1]);
- execl_git_cmd("pack-objects", "--stdout", "--progress", NULL);
+ execl_git_cmd("pack-objects", "--stdout", "--progress",
+ use_ofs_delta ? "--delta-base-offset" : NULL,
+ NULL);
kill(pid_rev_list, SIGKILL);
die("git-upload-pack: unable to exec git-pack-objects");
}
@@ -393,6 +395,8 @@ static void receive_needs(void)
multi_ack = 1;
if (strstr(line+45, "thin-pack"))
use_thin_pack = 1;
+ if (strstr(line+45, "ofs-delta"))
+ use_ofs_delta = 1;
if (strstr(line+45, "side-band-64k"))
use_sideband = LARGE_PACKET_MAX;
else if (strstr(line+45, "side-band"))
@@ -418,7 +422,7 @@ static void receive_needs(void)
static int send_ref(const char *refname, const unsigned char *sha1)
{
- static const char *capabilities = "multi_ack thin-pack side-band side-band-64k";
+ static const char *capabilities = "multi_ack thin-pack side-band side-band-64k ofs-delta";
struct object *o = parse_object(sha1);
if (!o)