{"thread":{"id":"6290","subject":"[PATCH] --prune is now default for 'pack-refs'","startedAt":"2007-01-09T00:44:04Z","lastAt":"2007-01-09T00:44:04Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"31171","messageId":"7vodp9t4ff.fsf@assigned-by-dhcp.cox.net","threadId":"6290","inReplyTo":null,"subject":"[PATCH] --prune is now default for 'pack-refs'","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-01-09T00:44:04Z","receivedAt":"2007-01-09T00:44:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"There is no reason not to, really.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\ndiff --git a/Documentation/git-pack-refs.txt b/Documentation/git-pack-refs.txt\nindex 5da5105..464269f 100644\n--- a/Documentation/git-pack-refs.txt\n+++ b/Documentation/git-pack-refs.txt\n@@ -7,7 +7,7 @@ git-pack-refs - Pack heads and tags for efficient repository access\n \n SYNOPSIS\n --------\n-'git-pack-refs' [--all] [--prune]\n+'git-pack-refs' [--all] [--no-prune]\n \n DESCRIPTION\n -----------\n@@ -40,10 +40,11 @@ developed and packing their tips does not help performance.\n This option causes branch tips to be packed as well.  Useful for\n a repository with many branches of historical interests.\n \n-\\--prune::\n+\\--no-prune::\n+\n+The command usually removes loose refs under `$GIT_DIR/refs`\n+hierarchy after packing them.  This option tells it not to.\n \n-After packing the refs, remove loose refs under `$GIT_DIR/refs`\n-hierarchy.  This should probably become default.\n \n Author\n ------\ndiff --git a/builtin-pack-refs.c b/builtin-pack-refs.c\nindex 8dc5b9e..6de7128 100644\n--- a/builtin-pack-refs.c\n+++ b/builtin-pack-refs.c\n@@ -4,7 +4,7 @@\n #include \"tag.h\"\n \n static const char builtin_pack_refs_usage[] =\n-\"git-pack-refs [--all] [--prune]\";\n+\"git-pack-refs [--all] [--prune | --no-prune]\";\n \n struct ref_to_prune {\n \tstruct ref_to_prune *next;\n@@ -90,10 +90,15 @@ int cmd_pack_refs(int argc, const char **argv, const char *prefix)\n \n \tmemset(&cbdata, 0, sizeof(cbdata));\n \n+\tcbdata.prune = 1;\n \tfor (i = 1; i < argc; i++) {\n \t\tconst char *arg = argv[i];\n \t\tif (!strcmp(arg, \"--prune\")) {\n-\t\t\tcbdata.prune = 1;\n+\t\t\tcbdata.prune = 1; /* now the default */\n+\t\t\tcontinue;\n+\t\t}\n+\t\tif (!strcmp(arg, \"--no-prune\")) {\n+\t\t\tcbdata.prune = 0;\n \t\t\tcontinue;\n \t\t}\n \t\tif (!strcmp(arg, \"--all\")) {\ndiff --git a/t/t3210-pack-refs.sh b/t/t3210-pack-refs.sh\nindex b1e9f2e..16bdae4 100755\n--- a/t/t3210-pack-refs.sh\n+++ b/t/t3210-pack-refs.sh\n@@ -34,7 +34,7 @@ test_expect_success \\\n     'see if a branch still exists when packed' \\\n     'git-branch b &&\n      git-pack-refs --all &&\n-     rm .git/refs/heads/b &&\n+     rm -f .git/refs/heads/b &&\n      echo \"$SHA1 refs/heads/b\" >expect &&\n      git-show-ref b >result &&\n      diff expect result'\n"}]}