git-clone: always keep pack sent from remote.
This deprecates --keep and -q flags and always keeps the pack sent from the remote site. Corresponding configuration variables are also removed. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Oct 19, 2005 at 14:43 UTC
e1c7ada6dd1fdf249d0bb84f3293d3be768b9239
1 file changed
+4
-68
clone-pack.c
+4
-68
@@ -3,10 +3,8 @@
3
#include "pkt-line.h"
4
#include <sys/wait.h>
5
6
-static int quiet;
7
-static int keep_pack;
6
static const char clone_pack_usage[] =
9
-"git-clone-pack [-q] [--keep] [--exec=<git-upload-pack>] [<host>:]<directory> [<heads>]*";
7
+"git-clone-pack [--exec=<git-upload-pack>] [<host>:]<directory> [<heads>]*";
8
static const char *exec = "git-upload-pack";
9
10
static void clone_handshake(int fd[2], struct ref *ref)
@@ -114,41 +112,6 @@ static void write_refs(struct ref *ref)
112
free(head_path);
113
}
114
117
-static int clone_by_unpack(int fd[2])
118
-{
119
- int status;
120
- pid_t pid;
121
-
122
- pid = fork();
123
- if (pid < 0)
124
- die("git-clone-pack: unable to fork off git-unpack-objects");
125
- if (!pid) {
126
- dup2(fd[0], 0);
127
- close(fd[0]);
128
- close(fd[1]);
129
- execlp("git-unpack-objects", "git-unpack-objects",
130
- quiet ? "-q" : NULL, NULL);
131
- die("git-unpack-objects exec failed");
132
- }
133
- close(fd[0]);
134
- close(fd[1]);
135
- while (waitpid(pid, &status, 0) < 0) {
136
- if (errno != EINTR)
137
- die("waiting for git-unpack-objects: %s", strerror(errno));
138
- }
139
- if (WIFEXITED(status)) {
140
- int code = WEXITSTATUS(status);
141
- if (code)
142
- die("git-unpack-objects died with error code %d", code);
143
- return 0;
144
- }
145
- if (WIFSIGNALED(status)) {
146
- int sig = WTERMSIG(status);
147
- die("git-unpack-objects died of signal %d", sig);
148
- }
149
- die("Sherlock Holmes! git-unpack-objects died of unnatural causes %d!", status);
150
-}
151
-
115
static int finish_pack(const char *pack_tmp_name)
116
{
117
int pipe_fd[2];
@@ -294,35 +257,13 @@ static int clone_pack(int fd[2], int nr_match, char **match)
257
}
258
clone_handshake(fd, refs);
259
297
- if (keep_pack)
298
- status = clone_without_unpack(fd);
299
- else
300
- status = clone_by_unpack(fd);
260
+ status = clone_without_unpack(fd);
261
262
if (!status)
263
write_refs(refs);
264
return status;
265
}
266
307
-static int clone_options(const char *var, const char *value)
308
-{
309
- if (!strcmp("clone.keeppack", var)) {
310
- keep_pack = git_config_bool(var, value);
311
- return 0;
312
- }
313
- if (!strcmp("clone.quiet", var)) {
314
- quiet = git_config_bool(var, value);
315
- return 0;
316
- }
317
- /*
318
- * Put other local option parsing for this program
319
- * here ...
320
- */
321
-
322
- /* Fall back on the default ones */
323
- return git_default_config(var, value);
324
-}
325
-
267
int main(int argc, char **argv)
268
{
269
int i, ret, nr_heads;
@@ -330,25 +271,20 @@ int main(int argc, char **argv)
271
int fd[2];
272
pid_t pid;
273
333
- git_config(clone_options);
274
nr_heads = 0;
275
heads = NULL;
276
for (i = 1; i < argc; i++) {
277
char *arg = argv[i];
278
279
if (*arg == '-') {
340
- if (!strcmp("-q", arg)) {
341
- quiet = 1;
280
+ if (!strcmp("-q", arg))
281
continue;
343
- }
282
if (!strncmp("--exec=", arg, 7)) {
283
exec = arg + 7;
284
continue;
285
}
348
- if (!strcmp("--keep", arg)) {
349
- keep_pack = 1;
286
+ if (!strcmp("--keep", arg))
287
continue;
351
- }
288
usage(clone_pack_usage);
289
}
290
dest = arg;