aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-01-21 21:29:44 -0800
committerJunio C Hamano <junkio@cox.net>2007-01-21 21:29:57 -0800
commit026aa93818a536c819a94aae5bbefe1b6251fe0e (patch)
tree4c03787020e72a0957972900f10a5905b1661bec
parent1bb914603a0f151669de2c31671f6c878c5eb79f (diff)
downloadgit-026aa93818a536c819a94aae5bbefe1b6251fe0e.tar.gz
git-026aa93818a536c819a94aae5bbefe1b6251fe0e.tar.xz
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.
-rw-r--r--Documentation/git-prune.txt9
-rw-r--r--builtin-prune.c31
-rwxr-xr-xt/t1410-reflog.sh6
-rwxr-xr-xt/t5400-send-pack.sh4
-rwxr-xr-xt/t5700-clone-reference.sh4
-rwxr-xr-xt/t5710-info-alternate.sh6
6 files changed, 12 insertions, 48 deletions
diff --git a/Documentation/git-prune.txt b/Documentation/git-prune.txt
index fbd344da4..a11e30309 100644
--- a/Documentation/git-prune.txt
+++ b/Documentation/git-prune.txt
@@ -8,7 +8,7 @@ git-prune - Prunes all unreachable objects from the object database
SYNOPSIS
--------
-'git-prune' [-n] [--grace=<time>]
+'git-prune' [-n] [--] [<head>...]
DESCRIPTION
-----------
@@ -28,12 +28,6 @@ OPTIONS
Do not remove anything; just report what it would
remove.
---grace=<time>::
- Do not prune loose objects that are younger than the
- specified time. This gives a grace period to newly
- created objects from getting pruned.
-
-////////////////////////////////////////////
\--::
Do not interpret any more arguments as options.
@@ -52,7 +46,6 @@ borrows from your repository via its
------------
$ git prune $(cd ../another && $(git-rev-parse --all))
------------
-////////////////////////////////////////////
Author
------
diff --git a/builtin-prune.c b/builtin-prune.c
index 7929af1aa..6f0ba0d04 100644
--- a/builtin-prune.c
+++ b/builtin-prune.c
@@ -5,9 +5,8 @@
#include "builtin.h"
#include "reachable.h"
-static const char prune_usage[] = "git-prune [-n] [--grace=time]";
+static const char prune_usage[] = "git-prune [-n]";
static int show_only;
-static int prune_grace_period;
static int prune_object(char *path, const char *filename, const unsigned char *sha1)
{
@@ -39,7 +38,6 @@ static int prune_dir(int i, char *path)
char name[100];
unsigned char sha1[20];
int len = strlen(de->d_name);
- struct stat st;
switch (len) {
case 2:
@@ -62,11 +60,6 @@ static int prune_dir(int i, char *path)
if (lookup_object(sha1))
continue;
- if (prune_grace_period > 0 &&
- !stat(mkpath("%s/%s", path, de->d_name), &st) &&
- st.st_mtime > prune_grace_period)
- continue;
-
prune_object(path, de->d_name, sha1);
continue;
}
@@ -86,25 +79,10 @@ static void prune_object_dir(const char *path)
}
}
-static int git_prune_config(const char *var, const char *value)
-{
- if (!strcmp(var, "gc.prunegrace")) {
- if (!strcmp(value, "off"))
- prune_grace_period = 0;
- else
- prune_grace_period = approxidate(value);
- return 0;
- }
- return git_default_config(var, value);
-}
-
int cmd_prune(int argc, const char **argv, const char *prefix)
{
int i;
struct rev_info revs;
- prune_grace_period = time(NULL)-24*60*60;
-
- git_config(git_prune_config);
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
@@ -112,13 +90,6 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
show_only = 1;
continue;
}
- if (!strncmp(arg, "--grace=", 8)) {
- if (!strcmp(arg+8, "off"))
- prune_grace_period = 0;
- else
- prune_grace_period = approxidate(arg+8);
- continue;
- }
usage(prune_usage);
}
diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh
index 0c435f957..8e8d526ef 100755
--- a/t/t1410-reflog.sh
+++ b/t/t1410-reflog.sh
@@ -96,7 +96,7 @@ test_expect_success setup '
check_have A B C D E F G H I J K L &&
- git prune --grace=off &&
+ git prune &&
check_have A B C D E F G H I J K L &&
@@ -115,7 +115,7 @@ test_expect_success rewind '
check_have A B C D E F G H I J K L &&
- git prune --grace=off &&
+ git prune &&
check_have A B C D E F G H I J K L &&
@@ -160,7 +160,7 @@ test_expect_success 'reflog expire' '
test_expect_success 'prune and fsck' '
- git prune --grace=off &&
+ git prune &&
check_fsck &&
check_have A B C D E H L &&
diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh
index 2a55d5ae3..2c151912a 100755
--- a/t/t5400-send-pack.sh
+++ b/t/t5400-send-pack.sh
@@ -55,13 +55,13 @@ test_expect_success setup '
test_expect_success 'pack the source repository' '
git repack -a -d &&
- git prune --grace=off
+ git prune
'
test_expect_success 'pack the destination repository' '
cd victim &&
git repack -a -d &&
- git prune --grace=off &&
+ git prune &&
cd ..
'
diff --git a/t/t5700-clone-reference.sh b/t/t5700-clone-reference.sh
index ab00e8fb6..dd9caad1c 100755
--- a/t/t5700-clone-reference.sh
+++ b/t/t5700-clone-reference.sh
@@ -22,7 +22,7 @@ echo second > file2 &&
git add file2 &&
git commit -m addition &&
git repack -a -d &&
-git prune --grace=off'
+git prune'
cd "$base_dir"
@@ -56,7 +56,7 @@ echo third > file3 &&
git add file3 &&
git commit -m update &&
git repack -a -d &&
-git prune --grace=off'
+git prune'
cd "$base_dir"
diff --git a/t/t5710-info-alternate.sh b/t/t5710-info-alternate.sh
index c30fee81f..b9f6d9636 100755
--- a/t/t5710-info-alternate.sh
+++ b/t/t5710-info-alternate.sh
@@ -29,7 +29,7 @@ echo "Hello World" > file1 &&
git add file1 &&
git commit -m "Initial commit" file1 &&
git repack -a -d &&
-git prune --grace=off'
+git prune'
cd "$base_dir"
@@ -39,7 +39,7 @@ echo "foo bar" > file2 &&
git add file2 &&
git commit -m "next commit" file2 &&
git repack -a -d -l &&
-git prune --grace=off'
+git prune'
cd "$base_dir"
@@ -49,7 +49,7 @@ echo "Goodbye, cruel world" > file3 &&
git add file3 &&
git commit -m "one more" file3 &&
git repack -a -d -l &&
-git prune --grace=off'
+git prune'
cd "$base_dir"