Revert "prune: --grace=time"
This reverts commit 9b088c4e394df84232cfd37aea78349a495b09c1. Protecting 'mature' objects does not make it any safer. We should admit that git-prune is inherently unsafe when run in parallel with other operations without involving unwarranted locking overhead, and with the latest git, even rebase and reset would not immediately create crufts anyway.
Junio C Hamano committed
Jan 21, 2007 at 21:29 UTC
026aa93818a536c819a94aae5bbefe1b6251fe0e
6 files changed
+12
-48
Documentation/git-prune.txt
+1
-8
@@ -8,7 +8,7 @@ git-prune - Prunes all unreachable objects from the object database
8
9
SYNOPSIS
10
--------
11
-'git-prune' [-n] [--grace=<time>]
11
+'git-prune' [-n] [--] [<head>...]
12
13
DESCRIPTION
14
-----------
@@ -28,12 +28,6 @@ OPTIONS
28
Do not remove anything; just report what it would
29
remove.
30
31
---grace=<time>::
32
- Do not prune loose objects that are younger than the
33
- specified time. This gives a grace period to newly
34
- created objects from getting pruned.
35
-
36
-////////////////////////////////////////////
31
\--::
32
Do not interpret any more arguments as options.
33
@@ -52,7 +46,6 @@ borrows from your repository via its
46
------------
47
$ git prune $(cd ../another && $(git-rev-parse --all))
48
------------
55
-////////////////////////////////////////////
49
50
Author
51
------
builtin-prune.c
+1
-30
@@ -5,9 +5,8 @@
5
#include "builtin.h"
6
#include "reachable.h"
7
8
-static const char prune_usage[] = "git-prune [-n] [--grace=time]";
8
+static const char prune_usage[] = "git-prune [-n]";
9
static int show_only;
10
-static int prune_grace_period;
10
11
static int prune_object(char *path, const char *filename, const unsigned char *sha1)
12
{
@@ -39,7 +38,6 @@ static int prune_dir(int i, char *path)
38
char name[100];
39
unsigned char sha1[20];
40
int len = strlen(de->d_name);
42
- struct stat st;
41
42
switch (len) {
43
case 2:
@@ -62,11 +60,6 @@ static int prune_dir(int i, char *path)
60
if (lookup_object(sha1))
61
continue;
62
65
- if (prune_grace_period > 0 &&
66
- !stat(mkpath("%s/%s", path, de->d_name), &st) &&
67
- st.st_mtime > prune_grace_period)
68
- continue;
69
-
63
prune_object(path, de->d_name, sha1);
64
continue;
65
}
@@ -86,25 +79,10 @@ static void prune_object_dir(const char *path)
79
}
80
}
81
89
-static int git_prune_config(const char *var, const char *value)
90
-{
91
- if (!strcmp(var, "gc.prunegrace")) {
92
- if (!strcmp(value, "off"))
93
- prune_grace_period = 0;
94
- else
95
- prune_grace_period = approxidate(value);
96
- return 0;
97
- }
98
- return git_default_config(var, value);
99
-}
100
-
82
int cmd_prune(int argc, const char **argv, const char *prefix)
83
{
84
int i;
85
struct rev_info revs;
105
- prune_grace_period = time(NULL)-24*60*60;
106
-
107
- git_config(git_prune_config);
86
87
for (i = 1; i < argc; i++) {
88
const char *arg = argv[i];
@@ -112,13 +90,6 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
90
show_only = 1;
91
continue;
92
}
115
- if (!strncmp(arg, "--grace=", 8)) {
116
- if (!strcmp(arg+8, "off"))
117
- prune_grace_period = 0;
118
- else
119
- prune_grace_period = approxidate(arg+8);
120
- continue;
121
- }
93
usage(prune_usage);
94
}
95
t/t1410-reflog.sh
+3
-3
@@ -96,7 +96,7 @@ test_expect_success setup '
96
97
check_have A B C D E F G H I J K L &&
98
99
- git prune --grace=off &&
99
+ git prune &&
100
101
check_have A B C D E F G H I J K L &&
102
@@ -115,7 +115,7 @@ test_expect_success rewind '
115
116
check_have A B C D E F G H I J K L &&
117
118
- git prune --grace=off &&
118
+ git prune &&
119
120
check_have A B C D E F G H I J K L &&
121
@@ -160,7 +160,7 @@ test_expect_success 'reflog expire' '
160
161
test_expect_success 'prune and fsck' '
162
163
- git prune --grace=off &&
163
+ git prune &&
164
check_fsck &&
165
166
check_have A B C D E H L &&
t/t5400-send-pack.sh
+2
-2
@@ -55,13 +55,13 @@ test_expect_success setup '
55
56
test_expect_success 'pack the source repository' '
57
git repack -a -d &&
58
- git prune --grace=off
58
+ git prune
59
'
60
61
test_expect_success 'pack the destination repository' '
62
cd victim &&
63
git repack -a -d &&
64
- git prune --grace=off &&
64
+ git prune &&
65
cd ..
66
'
67
t/t5700-clone-reference.sh
+2
-2
@@ -22,7 +22,7 @@ echo second > file2 &&
22
git add file2 &&
23
git commit -m addition &&
24
git repack -a -d &&
25
-git prune --grace=off'
25
+git prune'
26
27
cd "$base_dir"
28
@@ -56,7 +56,7 @@ echo third > file3 &&
56
git add file3 &&
57
git commit -m update &&
58
git repack -a -d &&
59
-git prune --grace=off'
59
+git prune'
60
61
cd "$base_dir"
62
t/t5710-info-alternate.sh
+3
-3
@@ -29,7 +29,7 @@ echo "Hello World" > file1 &&
29
git add file1 &&
30
git commit -m "Initial commit" file1 &&
31
git repack -a -d &&
32
-git prune --grace=off'
32
+git prune'
33
34
cd "$base_dir"
35
@@ -39,7 +39,7 @@ echo "foo bar" > file2 &&
39
git add file2 &&
40
git commit -m "next commit" file2 &&
41
git repack -a -d -l &&
42
-git prune --grace=off'
42
+git prune'
43
44
cd "$base_dir"
45
@@ -49,7 +49,7 @@ echo "Goodbye, cruel world" > file3 &&
49
git add file3 &&
50
git commit -m "one more" file3 &&
51
git repack -a -d -l &&
52
-git prune --grace=off'
52
+git prune'
53
54
cd "$base_dir"
55