@matheusbsbs / matheus-bagliano / commits / 64c381bf74
Fork 0

clone-pack: new option --keep tells it not to explode the pack.

With new option --keep, or a configuration item clone.keeppack (we need a better name, or start allowing dash,"clone.keep-pack"), the packed data downloaded while cloning is saved as a pack in .git/objects/pack/ locally, with index generated for it with git-index-pack. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Oct 12, 2005 at 18:12 UTC 64c381bf740a0a698fe7556fbb346b700b934f7c
2 files changed +10 -2
Documentation/git-clone-pack.txt
+6 -1
@@ -8,7 +8,7 @@ git-clone-pack - Clones a repository by receiving packed objects.
8
9 SYNOPSIS
10 --------
11 -'git-clone-pack' [-q] [--exec=<git-upload-pack>] [<host>:]<directory> [<head>...]
11 +'git-clone-pack' [-q] [--keep] [--exec=<git-upload-pack>] [<host>:]<directory> [<head>...]
12
13 DESCRIPTION
14 -----------
@@ -23,6 +23,11 @@ OPTIONS
23 Pass '-q' flag to 'git-unpack-objects'; this makes the
24 cloning process less verbose.
25
26 +--keep::
27 + Do not invoke 'git-unpack-objects' on received data, but
28 + create a single packfile out of it instead, and store it
29 + in the object database.
30 +
31 --exec=<git-upload-pack>::
32 Use this to specify the path to 'git-upload-pack' on the
33 remote side, if it is not found on your $PATH.
clone-pack.c
+4 -1
@@ -5,7 +5,8 @@
5
6 static int quiet;
7 static int keep_pack;
8 -static const char clone_pack_usage[] = "git-clone-pack [-q] [--exec=<git-upload-pack>] [<host>:]<directory> [<heads>]*";
8 +static const char clone_pack_usage[] =
9 +"git-clone-pack [-q] [--keep] [--exec=<git-upload-pack>] [<host>:]<directory> [<heads>]*";
10 static const char *exec = "git-upload-pack";
11
12 static void clone_handshake(int fd[2], struct ref *ref)
@@ -221,9 +222,11 @@ static int finish_pack(const char *pack_tmp_name)
222 snprintf(final, sizeof(final),
223 "%s/pack/pack-%s.pack", get_object_directory(), hash);
224 move_temp_to_file(pack_tmp_name, final);
225 + chmod(final, 0444);
226 snprintf(final, sizeof(final),
227 "%s/pack/pack-%s.idx", get_object_directory(), hash);
228 move_temp_to_file(idx, final);
229 + chmod(final, 0444);
230 return 0;
231
232 error_die: