summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 48c3242)
raw | patch | inline | side by side (parent: 48c3242)
author | Junio C Hamano <junkio@cox.net> | |
Wed, 27 Dec 2006 09:47:57 +0000 (01:47 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 27 Dec 2006 09:47:57 +0000 (01:47 -0800) |
Signed-off-by: Junio C Hamano <junkio@cox.net>
Documentation/config.txt | patch | blob | history | |
Documentation/git-reflog.txt | [new file with mode: 0644] | patch | blob |
Documentation/git.txt | patch | blob | history | |
builtin-reflog.c | patch | blob | history |
index 4d636267a3c58f194c3e0e5c682ac5cff8271900..6452a8be144f92f9140fb133acda4d9fd32f2b15 100644 (file)
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
Additional email headers to include in a patch to be submitted
by mail. See gitlink:git-format-patch[1].
+gc.reflogexpire::
+ `git reflog expire` removes reflog entries older than
+ this time; defaults to 90 days.
+
+gc.reflogexpireunreachable::
+ `git reflog expire` removes reflog entries older than
+ this time and are not reachable from the current tip;
+ defaults to 30 days.
+
gc.rerereresolved::
Records of conflicted merge you resolved earlier are
kept for this many days when `git rerere gc` is run.
diff --git a/Documentation/git-reflog.txt b/Documentation/git-reflog.txt
--- /dev/null
@@ -0,0 +1,59 @@
+git-reflog(1)
+=============
+
+NAME
+----
+git-reflog - Manage reflog information
+
+
+SYNOPSIS
+--------
+[verse]
+'git-reflog' expire [--dry-run]
+ [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...
+
+
+DESCRIPTION
+-----------
+
+Reflog is a mechanism to record when the tip of branches are
+updated. This command is to manage the information recorded in it.
+
+The subcommand "expire" is used to prune older reflog entries.
+Entries older than `expire` time, or entries older than
+`expire-unreachable` time and are not reachable from the current
+tip, are removed from the reflog. This is typically not used
+directly by the end users -- instead, see gitlink:git-gc[1].
+
+
+
+OPTIONS
+-------
+
+--expire=<time>::
+ Entries older than this time are pruned. Without the
+ option it is taken from configuration `gc.reflogExpire`,
+ which in turn defaults to 90 days.
+
+--expire-unreachable=<time>::
+ Entries older than this time and are not reachable from
+ the current tip of the branch are pruned. Without the
+ option it is taken from configuration
+ `gc.reflogExpireUnreachable`, which in turn defaults to
+ 30 days.
+
+--all::
+ Instead of listing <refs> explicitly, prune all refs.
+
+Author
+------
+Written by Junio C Hamano <junkio@cox.net>
+
+Documentation
+--------------
+Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
+
+GIT
+---
+Part of the gitlink:git[7] suite
+
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 2a9e97dac1e2c21a8a4aa7a6501a054fcefbef35..4ed3eed13d383cac4f1fa171b3ab6fb62f63c06a 100644 (file)
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
gitlink:git-quiltimport[1]::
Applies a quilt patchset onto the current branch.
+gitlink:git-reflog[1]::
+ Manage reflog information.
+
gitlink:git-relink[1]::
Hardlink common objects in local repositories.
diff --git a/builtin-reflog.c b/builtin-reflog.c
index de31967b99e89e21fe0ddd6aaacb17364d6f3a4b..d3f2f50d2bc7b4ef0f0e4801c70c5a15ff869f1f 100644 (file)
--- a/builtin-reflog.c
+++ b/builtin-reflog.c
#include "dir.h"
#include "tree-walk.h"
+static unsigned long default_reflog_expire;
+static unsigned long default_reflog_expire_unreachable;
+
struct expire_reflog_cb {
FILE *newlog;
const char *ref;
@@ -150,6 +153,17 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused,
return status;
}
+static int reflog_expire_config(const char *var, const char *value)
+{
+ if (!strcmp(var, "gc.reflogexpire"))
+ default_reflog_expire = approxidate(value);
+ else if (!strcmp(var, "gc.reflogexpireunreachable"))
+ default_reflog_expire_unreachable = approxidate(value);
+ else
+ return git_default_config(var, value);
+ return 0;
+}
+
static const char reflog_expire_usage[] =
"git-reflog expire [--dry-run] [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...";
unsigned long now = time(NULL);
int i, status, do_all;
+ git_config(reflog_expire_config);
+
save_commit_buffer = 0;
do_all = status = 0;
memset(&cb, 0, sizeof(cb));
- cb.expire_total = now - 90 * 24 * 3600;
- cb.expire_unreachable = now - 30 * 24 * 3600;
+
+ if (!default_reflog_expire_unreachable)
+ default_reflog_expire_unreachable = now - 30 * 24 * 3600;
+ if (!default_reflog_expire)
+ default_reflog_expire = now - 90 * 24 * 3600;
+ cb.expire_total = default_reflog_expire;
+ cb.expire_unreachable = default_reflog_expire_unreachable;
for (i = 1; i < argc; i++) {
const char *arg = argv[i];