@matheusbsbs / matheus-bagliano / commits / 4508dde169
Fork 0

Revert "send-pack --keep: do not explode into loose objects on the receiving end."

This reverts commit c7740a943ec896247ebc5514b6be02710caf3c53. There should be a way to make this controllable from the receiver end.

Junio C Hamano committed Oct 30, 2006 at 16:02 UTC 4508dde16951df00529207f179fee405e8646a64
4 files changed +10 -48
receive-pack.c
+3 -16
@@ -8,14 +8,10 @@
8 static const char receive_pack_usage[] = "git-receive-pack <git-dir>";
9
10 static const char *unpacker[] = { "unpack-objects", NULL };
11 -static const char *keep_packer[] = {
12 - "index-pack", "--stdin", "--fix-thin", NULL
13 -};
11
12 static int report_status;
16 -static int keep_pack;
13
18 -static char capabilities[] = "report-status keep-pack";
14 +static char capabilities[] = "report-status";
15 static int capabilities_sent;
16
17 static int show_ref(const char *path, const unsigned char *sha1)
@@ -265,8 +261,6 @@ static void read_head_info(void)
261 if (reflen + 82 < len) {
262 if (strstr(refname + reflen + 1, "report-status"))
263 report_status = 1;
268 - if (strstr(refname + reflen + 1, "keep-pack"))
269 - keep_pack = 1;
264 }
265 cmd = xmalloc(sizeof(struct command) + len - 80);
266 hashcpy(cmd->old_sha1, old_sha1);
@@ -281,14 +275,7 @@ static void read_head_info(void)
275
276 static const char *unpack(int *error_code)
277 {
284 - int code;
285 -
286 - if (keep_pack)
287 - code = run_command_v_opt(ARRAY_SIZE(keep_packer) - 1,
288 - keep_packer, RUN_GIT_CMD);
289 - else
290 - code = run_command_v_opt(ARRAY_SIZE(unpacker) - 1,
291 - unpacker, RUN_GIT_CMD);
278 + int code = run_command_v_opt(1, unpacker, RUN_GIT_CMD);
279
280 *error_code = 0;
281 switch (code) {
@@ -348,7 +335,7 @@ int main(int argc, char **argv)
335 if (!dir)
336 usage(receive_pack_usage);
337
351 - if (!enter_repo(dir, 0))
338 + if(!enter_repo(dir, 0))
339 die("'%s': unable to chdir or not a git archive", dir);
340
341 write_head_info();
send-pack.c
+5 -18
@@ -6,14 +6,13 @@
6 #include "exec_cmd.h"
7
8 static const char send_pack_usage[] =
9 -"git-send-pack [--all] [--keep] [--exec=git-receive-pack] <remote> [<head>...]\n"
9 +"git-send-pack [--all] [--exec=git-receive-pack] <remote> [<head>...]\n"
10 " --all and explicit <head> specification are mutually exclusive.";
11 static const char *exec = "git-receive-pack";
12 static int verbose;
13 static int send_all;
14 static int force_update;
15 static int use_thin_pack;
16 -static int keep_pack;
16
17 static int is_zero_sha1(const unsigned char *sha1)
18 {
@@ -271,7 +270,6 @@ static int send_pack(int in, int out, int nr_refspec, char **refspec)
270 int new_refs;
271 int ret = 0;
272 int ask_for_status_report = 0;
274 - int ask_to_keep_pack = 0;
273 int expect_status_report = 0;
274
275 /* No funny business with the matcher */
@@ -281,8 +279,6 @@ static int send_pack(int in, int out, int nr_refspec, char **refspec)
279 /* Does the other end support the reporting? */
280 if (server_supports("report-status"))
281 ask_for_status_report = 1;
284 - if (server_supports("keep-pack") && keep_pack)
285 - ask_to_keep_pack = 1;
282
283 /* match them up */
284 if (!remote_tail)
@@ -359,17 +355,12 @@ static int send_pack(int in, int out, int nr_refspec, char **refspec)
355 strcpy(old_hex, sha1_to_hex(ref->old_sha1));
356 new_hex = sha1_to_hex(ref->new_sha1);
357
362 - if (ask_for_status_report || ask_to_keep_pack) {
363 - packet_write(out, "%s %s %s%c%s%s",
358 + if (ask_for_status_report) {
359 + packet_write(out, "%s %s %s%c%s",
360 old_hex, new_hex, ref->name, 0,
365 - ask_for_status_report
366 - ? " report-status" : "",
367 - ask_to_keep_pack
368 - ? " keep-pack" : "");
369 - if (ask_for_status_report)
370 - expect_status_report = 1;
361 + "report-status");
362 ask_for_status_report = 0;
372 - ask_to_keep_pack = 0;
363 + expect_status_report = 1;
364 }
365 else
366 packet_write(out, "%s %s %s",
@@ -428,10 +419,6 @@ int main(int argc, char **argv)
419 verbose = 1;
420 continue;
421 }
431 - if (!strcmp(arg, "--keep")) {
432 - keep_pack = 1;
433 - continue;
434 - }
422 if (!strcmp(arg, "--thin")) {
423 use_thin_pack = 1;
424 continue;
sha1_file.c
+2 -5
@@ -1292,7 +1292,7 @@ static void *read_packed_sha1(const unsigned char *sha1, char *type, unsigned lo
1292 return unpack_entry(&e, type, size);
1293 }
1294
1295 -void *read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size)
1295 +void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size)
1296 {
1297 unsigned long mapsize;
1298 void *map, *buf;
@@ -1757,10 +1757,7 @@ int has_sha1_file(const unsigned char *sha1)
1757
1758 if (find_pack_entry(sha1, &e, NULL))
1759 return 1;
1760 - if (find_sha1_file(sha1, &st))
1761 - return 1;
1762 - reprepare_packed_git();
1763 - return find_pack_entry(sha1, &e, NULL);
1760 + return find_sha1_file(sha1, &st) ? 1 : 0;
1761 }
1762
1763 /*
t/t5400-send-pack.sh
-9
@@ -78,13 +78,4 @@ test_expect_success \
78 ! diff -u .git/refs/heads/master victim/.git/refs/heads/master
79 '
80
81 -test_expect_success 'push with --keep' '
82 - t=`cd victim && git-rev-parse --verify refs/heads/master` &&
83 - git-update-ref refs/heads/master $t &&
84 - : > foo &&
85 - git add foo &&
86 - git commit -m "one more" &&
87 - git-send-pack --keep ./victim/.git/ master
88 -'
89 -
81 test_done