diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-03-08 00:36:01 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-03-08 00:36:01 -0800 |
commit | 030bc0aa8b012170b69f40f95b152a1080447301 (patch) | |
tree | 0f77de6b03c86309a6157fc778fcc783910e1423 /builtin-prune.c | |
parent | 193c7aaf5f17116f5e3e2449326fd9f6cdfc062d (diff) | |
parent | 4a9f439415eda734914c7328a2326ee9590246ee (diff) | |
download | git-030bc0aa8b012170b69f40f95b152a1080447301.tar.gz |
Merge branch 'as/maint-expire' into maint
* as/maint-expire:
reflog: honor gc.reflogexpire=never
prune: honor --expire=never
Diffstat (limited to 'builtin-prune.c')
-rw-r--r-- | builtin-prune.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/builtin-prune.c b/builtin-prune.c index 4675f6054f..81f915ec31 100644 --- a/builtin-prune.c +++ b/builtin-prune.c @@ -18,13 +18,11 @@ static unsigned long expire; static int prune_tmp_object(const char *path, const char *filename) { const char *fullpath = mkpath("%s/%s", path, filename); - if (expire) { - struct stat st; - if (lstat(fullpath, &st)) - return error("Could not stat '%s'", fullpath); - if (st.st_mtime > expire) - return 0; - } + struct stat st; + if (lstat(fullpath, &st)) + return error("Could not stat '%s'", fullpath); + if (st.st_mtime > expire) + return 0; printf("Removing stale temporary file %s\n", fullpath); if (!show_only) unlink_or_warn(fullpath); @@ -34,13 +32,11 @@ static int prune_tmp_object(const char *path, const char *filename) static int prune_object(char *path, const char *filename, const unsigned char *sha1) { const char *fullpath = mkpath("%s/%s", path, filename); - if (expire) { - struct stat st; - if (lstat(fullpath, &st)) - return error("Could not stat '%s'", fullpath); - if (st.st_mtime > expire) - return 0; - } + struct stat st; + if (lstat(fullpath, &st)) + return error("Could not stat '%s'", fullpath); + if (st.st_mtime > expire) + return 0; if (show_only || verbose) { enum object_type type = sha1_object_info(sha1, NULL); printf("%s %s\n", sha1_to_hex(sha1), @@ -139,6 +135,7 @@ int cmd_prune(int argc, const char **argv, const char *prefix) }; char *s; + expire = ULONG_MAX; save_commit_buffer = 0; read_replace_refs = 0; init_revisions(&revs, prefix); |