{"thread":{"id":"43097","subject":"[PATCH] Revert \"send-pack --keep: do not explode into loose objects on the receiving end.\"","startedAt":"2006-10-30T22:35:51Z","lastAt":"2006-10-30T22:35:51Z","messageCount":1,"participants":["Shawn Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"293840","messageId":"20061030223551.GG5775@spearce.org","threadId":"43097","inReplyTo":null,"subject":"[PATCH] Revert \"send-pack --keep: do not explode into loose objects on the receiving end.\"","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-10-30T22:35:51Z","receivedAt":"2006-10-30T22:35:51Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"This reverts commit c7740a943ec896247ebc5514b6be02710caf3c53.\n\nBoth Nico and I feel that this is a local matter.   It should not\nbe decided by the pushing end of the connection.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n receive-pack.c       |   19 +++----------------\n send-pack.c          |   23 +++++------------------\n sha1_file.c          |    7 ++-----\n t/t5400-send-pack.sh |    9 ---------\n 4 files changed, 10 insertions(+), 48 deletions(-)\n\ndiff --git a/receive-pack.c b/receive-pack.c\nindex e966148..7e154c5 100644\n--- a/receive-pack.c\n+++ b/receive-pack.c\n@@ -8,15 +8,11 @@\n static const char receive_pack_usage[] = \"git-receive-pack <git-dir>\";\n \n static const char *unpacker[] = { \"unpack-objects\", NULL };\n-static const char *keep_packer[] = {\n-\t\"index-pack\", \"--stdin\", \"--fix-thin\", NULL\n-};\n \n static int deny_non_fast_forwards = 0;\n static int report_status;\n-static int keep_pack;\n \n-static char capabilities[] = \"report-status keep-pack\";\n+static char capabilities[] = \"report-status\";\n static int capabilities_sent;\n \n static int receive_pack_config(const char *var, const char *value)\n@@ -219,8 +215,6 @@ static void read_head_info(void)\n \t\tif (reflen + 82 < len) {\n \t\t\tif (strstr(refname + reflen + 1, \"report-status\"))\n \t\t\t\treport_status = 1;\n-\t\t\tif (strstr(refname + reflen + 1, \"keep-pack\"))\n-\t\t\t\tkeep_pack = 1;\n \t\t}\n \t\tcmd = xmalloc(sizeof(struct command) + len - 80);\n \t\thashcpy(cmd->old_sha1, old_sha1);\n@@ -235,14 +229,7 @@ static void read_head_info(void)\n \n static const char *unpack()\n {\n-\tint code;\n-\n-\tif (keep_pack)\n-\t\tcode = run_command_v_opt(ARRAY_SIZE(keep_packer) - 1,\n-\t\t\t\t\t keep_packer, RUN_GIT_CMD);\n-\telse\n-\t\tcode = run_command_v_opt(ARRAY_SIZE(unpacker) - 1,\n-\t\t\t\t\t unpacker, RUN_GIT_CMD);\n+\tint code = run_command_v_opt(1, unpacker, RUN_GIT_CMD);\n \n \tswitch (code) {\n \tcase 0:\n@@ -300,7 +287,7 @@ int main(int argc, char **argv)\n \tif (!dir)\n \t\tusage(receive_pack_usage);\n \n-\tif (!enter_repo(dir, 0))\n+\tif(!enter_repo(dir, 0))\n \t\tdie(\"'%s': unable to chdir or not a git archive\", dir);\n \n \tsetup_ident();\ndiff --git a/send-pack.c b/send-pack.c\nindex 0e90548..fbd792c 100644\n--- a/send-pack.c\n+++ b/send-pack.c\n@@ -6,14 +6,13 @@\n #include \"exec_cmd.h\"\n \n static const char send_pack_usage[] =\n-\"git-send-pack [--all] [--keep] [--exec=git-receive-pack] <remote> [<head>...]\\n\"\n+\"git-send-pack [--all] [--exec=git-receive-pack] <remote> [<head>...]\\n\"\n \"  --all and explicit <head> specification are mutually exclusive.\";\n static const char *exec = \"git-receive-pack\";\n static int verbose;\n static int send_all;\n static int force_update;\n static int use_thin_pack;\n-static int keep_pack;\n \n static int is_zero_sha1(const unsigned char *sha1)\n {\n@@ -271,7 +270,6 @@ static int send_pack(int in, int out, in\n \tint new_refs;\n \tint ret = 0;\n \tint ask_for_status_report = 0;\n-\tint ask_to_keep_pack = 0;\n \tint expect_status_report = 0;\n \n \t/* No funny business with the matcher */\n@@ -281,8 +279,6 @@ static int send_pack(int in, int out, in\n \t/* Does the other end support the reporting? */\n \tif (server_supports(\"report-status\"))\n \t\task_for_status_report = 1;\n-\tif (server_supports(\"keep-pack\") && keep_pack)\n-\t\task_to_keep_pack = 1;\n \n \t/* match them up */\n \tif (!remote_tail)\n@@ -359,17 +355,12 @@ static int send_pack(int in, int out, in\n \t\tstrcpy(old_hex, sha1_to_hex(ref->old_sha1));\n \t\tnew_hex = sha1_to_hex(ref->new_sha1);\n \n-\t\tif (ask_for_status_report || ask_to_keep_pack) {\n-\t\t\tpacket_write(out, \"%s %s %s%c%s%s\",\n+\t\tif (ask_for_status_report) {\n+\t\t\tpacket_write(out, \"%s %s %s%c%s\",\n \t\t\t\t     old_hex, new_hex, ref->name, 0,\n-\t\t\t\t     ask_for_status_report\n-\t\t\t\t     ? \" report-status\" : \"\",\n-\t\t\t\t     ask_to_keep_pack\n-\t\t\t\t     ? \" keep-pack\" : \"\");\n-\t\t\tif (ask_for_status_report)\n-\t\t\t\texpect_status_report = 1;\n+\t\t\t\t     \"report-status\");\n \t\t\task_for_status_report = 0;\n-\t\t\task_to_keep_pack = 0;\n+\t\t\texpect_status_report = 1;\n \t\t}\n \t\telse\n \t\t\tpacket_write(out, \"%s %s %s\",\n@@ -428,10 +419,6 @@ int main(int argc, char **argv)\n \t\t\t\tverbose = 1;\n \t\t\t\tcontinue;\n \t\t\t}\n-\t\t\tif (!strcmp(arg, \"--keep\")) {\n-\t\t\t\tkeep_pack = 1;\n-\t\t\t\tcontinue;\n-\t\t\t}\n \t\t\tif (!strcmp(arg, \"--thin\")) {\n \t\t\t\tuse_thin_pack = 1;\n \t\t\t\tcontinue;\ndiff --git a/sha1_file.c b/sha1_file.c\nindex 59883a9..5e6c8b8 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -1310,7 +1310,7 @@ static void *read_packed_sha1(const unsi\n \treturn unpack_entry(&e, type, size);\n }\n \n-void *read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size)\n+void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size)\n {\n \tunsigned long mapsize;\n \tvoid *map, *buf;\n@@ -1775,10 +1775,7 @@ int has_sha1_file(const unsigned char *s\n \n \tif (find_pack_entry(sha1, &e, NULL))\n \t\treturn 1;\n-\tif (find_sha1_file(sha1, &st))\n-\t\treturn 1;\n-\treprepare_packed_git();\n-\treturn find_pack_entry(sha1, &e, NULL);\n+\treturn find_sha1_file(sha1, &st) ? 1 : 0;\n }\n \n /*\ndiff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh\nindex d831f8d..8afb899 100755\n--- a/t/t5400-send-pack.sh\n+++ b/t/t5400-send-pack.sh\n@@ -78,13 +78,4 @@ test_expect_success \\\n \t! diff -u .git/refs/heads/master victim/.git/refs/heads/master\n '\n \n-test_expect_success 'push with --keep' '\n-\tt=`cd victim && git-rev-parse --verify refs/heads/master` &&\n-\tgit-update-ref refs/heads/master $t &&\n-\t: > foo &&\n-\tgit add foo &&\n-\tgit commit -m \"one more\" &&\n-\tgit-send-pack --keep ./victim/.git/ master\n-'\n-\n test_done\n-- \n1.4.3.3.g7d63\n"}]}