[RFC] send-pack: allow skipping delta when sending pack

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

 



I have a git repo where I keep relatively large files (digital photos).
I have a local repo and a "master" repo on a server which I access over
ssh.  Deltifying a bunch of large images takes a relatively long time. I
can live with this while packing (though it is slightly annoying to have
to pack separately on both repos, I understand why it might be hard to
reuse the deltification).

However, it is extremely annoying to add a large set of images and then
push them to the server. The server is on a 100Mbit LAN, so the
deltification part of the process takes up most of the time (and
typically ends up making no deltas, since the files are unrelated
images). The patch below causes the GIT_NODELTA environment variable to
set the window depth to 0 when sending a pack, preventing deltification.

The result is much better performance in my case. However, the method
seems quite hack-ish, so I wanted to get comments on how this should be
done. Possibilities I considered:
  1. A command line option to git-send-pack. The problem with this is
     that support is required from git-push and cg-push to pass the
     option through.
  2. A repo config variable that says not to deltify on sending (or
     potentially, not to deltify at all, which makes packing in general
     much nicer -- however, I don't think this is a good idea, as I do
     still want deltification rarely, it's just that it mostly will
     fail). This should probably be per-remote for the obvious reason
     that one might push to local and remote repos. One drawback is that
     sometimes deltification may be a win; it's just that I sometimes
     know that it won't be (because I added a bunch of unrelated large
     files). It's nice to selectively turn this option on for a given
     push.
  3. Ideally, we could do some heuristic to see if deltification will
     yield helpful results. In particular, we may already have a pack
     with these commits in it (especially if we just repack before a
     push). If we can re-use this information, it at least saves
     deltifying twice (once to pack, once to push). In theory, I would
     think the fact that we don't pass --no-reuse-delta to pack-objects
     means that this would happen automatically, but it clearly doesn't.

Comments?

---

f1cf653120dd492d1c86ee2a92a9c8221023cef1
 send-pack.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

f1cf653120dd492d1c86ee2a92a9c8221023cef1
diff --git a/send-pack.c b/send-pack.c
index 409f188..4ad6489 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -30,8 +30,14 @@ static void exec_pack_objects(void)
 	static const char *args[] = {
 		"pack-objects",
 		"--stdout",
+		NULL,
 		NULL
 	};
+	const char *nodelta;
+
+	nodelta = getenv("GIT_NODELTA");
+	if(nodelta && !strcmp(nodelta, "1"))
+		args[2] = "--depth=0";
 	execv_git_cmd(args);
 	die("git-pack-objects exec failed (%s)", strerror(errno));
 }
-- 
1.3.3.g288c-dirty

-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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]