@matheusbsbs / matheus-bagliano / commits / 0f018baba6
Fork 0

--prune is now default for 'pack-refs'

There is no reason not to, really. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Jan 8, 2007 at 14:40 UTC 0f018baba654347b5ce746253b99d59707f80184
3 files changed +13 -7
Documentation/git-pack-refs.txt
+5 -4
@@ -7,7 +7,7 @@ git-pack-refs - Pack heads and tags for efficient repository access
7
8 SYNOPSIS
9 --------
10 -'git-pack-refs' [--all] [--prune]
10 +'git-pack-refs' [--all] [--no-prune]
11
12 DESCRIPTION
13 -----------
@@ -40,10 +40,11 @@ developed and packing their tips does not help performance.
40 This option causes branch tips to be packed as well. Useful for
41 a repository with many branches of historical interests.
42
43 -\--prune::
43 +\--no-prune::
44 +
45 +The command usually removes loose refs under `$GIT_DIR/refs`
46 +hierarchy after packing them. This option tells it not to.
47
45 -After packing the refs, remove loose refs under `$GIT_DIR/refs`
46 -hierarchy. This should probably become default.
48
49 Author
50 ------
builtin-pack-refs.c
+7 -2
@@ -4,7 +4,7 @@
4 #include "tag.h"
5
6 static const char builtin_pack_refs_usage[] =
7 -"git-pack-refs [--all] [--prune]";
7 +"git-pack-refs [--all] [--prune | --no-prune]";
8
9 struct ref_to_prune {
10 struct ref_to_prune *next;
@@ -90,10 +90,15 @@ int cmd_pack_refs(int argc, const char **argv, const char *prefix)
90
91 memset(&cbdata, 0, sizeof(cbdata));
92
93 + cbdata.prune = 1;
94 for (i = 1; i < argc; i++) {
95 const char *arg = argv[i];
96 if (!strcmp(arg, "--prune")) {
96 - cbdata.prune = 1;
97 + cbdata.prune = 1; /* now the default */
98 + continue;
99 + }
100 + if (!strcmp(arg, "--no-prune")) {
101 + cbdata.prune = 0;
102 continue;
103 }
104 if (!strcmp(arg, "--all")) {
t/t3210-pack-refs.sh
+1 -1
@@ -34,7 +34,7 @@ test_expect_success \
34 'see if a branch still exists when packed' \
35 'git-branch b &&
36 git-pack-refs --all &&
37 - rm .git/refs/heads/b &&
37 + rm -f .git/refs/heads/b &&
38 echo "$SHA1 refs/heads/b" >expect &&
39 git-show-ref b >result &&
40 diff expect result'