* [PATCH] make shallow repository deepening more network efficient
@ 2009-09-03 23:08 Nicolas Pitre
2009-09-06 5:11 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Pitre @ 2009-09-03 23:08 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
First of all, I can't find any reason why thin pack generation is
explicitly disabled when dealing with a shallow repository. The
possible delta base objects are collected from the edge commits which
are always obtained through history walking with the same shallow refs
as the client, Therefore the client is always going to have those base
objects available. So let's remove that restriction.
Then we can make shallow repository deepening much more efficient by
using the remote's unshallowed commits as edge commits to get preferred
base objects for thin pack generation. On git.git, this makes the data
transfer for the deepening of a shallow repository from depth 1 to depth 2
around 134 KB instead of 3.68 MB.
Signed-off-by: Nicolas Pitre <nico@cam.org>
diff --git a/upload-pack.c b/upload-pack.c
index f73e3c9..c77ab71 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -32,6 +32,7 @@ static int no_progress, daemon_mode;
static int shallow_nr;
static struct object_array have_obj;
static struct object_array want_obj;
+static struct object_array extra_edge_obj;
static unsigned int timeout;
/* 0 for no sideband,
* otherwise maximum packet size (up to 65520 bytes).
@@ -135,6 +136,10 @@ static int do_rev_list(int fd, void *create_full_pack)
if (prepare_revision_walk(&revs))
die("revision walk setup failed");
mark_edges_uninteresting(revs.commits, &revs, show_edge);
+ if (use_thin_pack)
+ for (i = 0; i < extra_edge_obj.nr; i++)
+ fprintf(pack_pipe, "-%s\n", sha1_to_hex(
+ extra_edge_obj.objects[i].item->sha1));
traverse_commit_list(&revs, show_commit, show_object, NULL);
fflush(pack_pipe);
fclose(pack_pipe);
@@ -562,7 +567,6 @@ static void receive_needs(void)
if (!prefixcmp(line, "shallow ")) {
unsigned char sha1[20];
struct object *object;
- use_thin_pack = 0;
if (get_sha1(line + 8, sha1))
die("invalid shallow line: %s", line);
object = parse_object(sha1);
@@ -574,7 +578,6 @@ static void receive_needs(void)
}
if (!prefixcmp(line, "deepen ")) {
char *end;
- use_thin_pack = 0;
depth = strtol(line + 7, &end, 0);
if (end == line + 7 || depth <= 0)
die("Invalid deepen: %s", line);
@@ -657,6 +660,7 @@ static void receive_needs(void)
NULL, &want_obj);
parents = parents->next;
}
+ add_object_array(object, NULL, &extra_edge_obj);
}
/* make sure commit traversal conforms to client */
register_shallow(object->sha1);
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] make shallow repository deepening more network efficient
2009-09-03 23:08 [PATCH] make shallow repository deepening more network efficient Nicolas Pitre
@ 2009-09-06 5:11 ` Junio C Hamano
2009-09-26 13:26 ` Johannes Schindelin
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2009-09-06 5:11 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Nicolas Pitre, git
Nicolas Pitre <nico@cam.org> writes:
> First of all, I can't find any reason why thin pack generation is
> explicitly disabled when dealing with a shallow repository. The
> possible delta base objects are collected from the edge commits which
> are always obtained through history walking with the same shallow refs
> as the client, Therefore the client is always going to have those base
> objects available. So let's remove that restriction.
>
> Then we can make shallow repository deepening much more efficient by
> using the remote's unshallowed commits as edge commits to get preferred
> base objects for thin pack generation. On git.git, this makes the data
> transfer for the deepening of a shallow repository from depth 1 to depth 2
> around 134 KB instead of 3.68 MB.
>
> Signed-off-by: Nicolas Pitre <nico@cam.org>
Dscho, this is your code from around ed09aef (support fetching into a
shallow repository, 2006-10-30) and f53514b (allow deepening of a shallow
repository, 2006-10-30). The latter disables thin pack transfer but the
log does not attempt to justify the change.
Have any comments?
> diff --git a/upload-pack.c b/upload-pack.c
> index f73e3c9..c77ab71 100644
> --- a/upload-pack.c
> +++ b/upload-pack.c
> @@ -32,6 +32,7 @@ static int no_progress, daemon_mode;
> static int shallow_nr;
> static struct object_array have_obj;
> static struct object_array want_obj;
> +static struct object_array extra_edge_obj;
> static unsigned int timeout;
> /* 0 for no sideband,
> * otherwise maximum packet size (up to 65520 bytes).
> @@ -135,6 +136,10 @@ static int do_rev_list(int fd, void *create_full_pack)
> if (prepare_revision_walk(&revs))
> die("revision walk setup failed");
> mark_edges_uninteresting(revs.commits, &revs, show_edge);
> + if (use_thin_pack)
> + for (i = 0; i < extra_edge_obj.nr; i++)
> + fprintf(pack_pipe, "-%s\n", sha1_to_hex(
> + extra_edge_obj.objects[i].item->sha1));
> traverse_commit_list(&revs, show_commit, show_object, NULL);
> fflush(pack_pipe);
> fclose(pack_pipe);
> @@ -562,7 +567,6 @@ static void receive_needs(void)
> if (!prefixcmp(line, "shallow ")) {
> unsigned char sha1[20];
> struct object *object;
> - use_thin_pack = 0;
> if (get_sha1(line + 8, sha1))
> die("invalid shallow line: %s", line);
> object = parse_object(sha1);
> @@ -574,7 +578,6 @@ static void receive_needs(void)
> }
> if (!prefixcmp(line, "deepen ")) {
> char *end;
> - use_thin_pack = 0;
> depth = strtol(line + 7, &end, 0);
> if (end == line + 7 || depth <= 0)
> die("Invalid deepen: %s", line);
> @@ -657,6 +660,7 @@ static void receive_needs(void)
> NULL, &want_obj);
> parents = parents->next;
> }
> + add_object_array(object, NULL, &extra_edge_obj);
> }
> /* make sure commit traversal conforms to client */
> register_shallow(object->sha1);
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] make shallow repository deepening more network efficient
2009-09-06 5:11 ` Junio C Hamano
@ 2009-09-26 13:26 ` Johannes Schindelin
0 siblings, 0 replies; 3+ messages in thread
From: Johannes Schindelin @ 2009-09-26 13:26 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Nicolas Pitre, git
Hi,
On Sat, 5 Sep 2009, Junio C Hamano wrote:
> Nicolas Pitre <nico@cam.org> writes:
>
> > First of all, I can't find any reason why thin pack generation is
> > explicitly disabled when dealing with a shallow repository. The
> > possible delta base objects are collected from the edge commits which
> > are always obtained through history walking with the same shallow refs
> > as the client, Therefore the client is always going to have those base
> > objects available. So let's remove that restriction.
> >
> > Then we can make shallow repository deepening much more efficient by
> > using the remote's unshallowed commits as edge commits to get preferred
> > base objects for thin pack generation. On git.git, this makes the data
> > transfer for the deepening of a shallow repository from depth 1 to depth 2
> > around 134 KB instead of 3.68 MB.
> >
> > Signed-off-by: Nicolas Pitre <nico@cam.org>
>
> Dscho, this is your code from around ed09aef (support fetching into a
> shallow repository, 2006-10-30) and f53514b (allow deepening of a shallow
> repository, 2006-10-30). The latter disables thin pack transfer but the
> log does not attempt to justify the change.
>
> Have any comments?
Unfortunately, I do not have any. I tried to remember, then I tried to
find some documentation, but stopped when I found out that I developed
the code on an iBook which died early Nov 2006.
So no, I do not remember why the change.
Sorry,
Dscho
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-09-26 13:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-03 23:08 [PATCH] make shallow repository deepening more network efficient Nicolas Pitre
2009-09-06 5:11 ` Junio C Hamano
2009-09-26 13:26 ` Johannes Schindelin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox