Skip to content

Commit

Permalink
rerere gc: honor configuration and document it
Browse files Browse the repository at this point in the history
Two configuration to control the expiration of rerere records
are introduced and documented.

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Dec 27, 2006
1 parent ae72f68 commit 48c3242
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
10 changes: 10 additions & 0 deletions Documentation/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,16 @@ format.headers::
Additional email headers to include in a patch to be submitted
by mail. See gitlink:git-format-patch[1].

gc.rerereresolved::
Records of conflicted merge you resolved earlier are
kept for this many days when `git rerere gc` is run.
The default is 60 days. See gitlink:git-rerere[1].

gc.rerereunresolved::
Records of conflicted merge you have not resolved are
kept for this many days when `git rerere gc` is run.
The default is 15 days. See gitlink:git-rerere[1].

gitcvs.enabled::
Whether the cvs pserver interface is enabled for this repository.
See gitlink:git-cvsserver[1].
Expand Down
8 changes: 6 additions & 2 deletions Documentation/git-rerere.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ git-rerere - Reuse recorded resolve

SYNOPSIS
--------
'git-rerere' [clear|diff|status]
'git-rerere' [clear|diff|status|gc]

DESCRIPTION
-----------
Expand Down Expand Up @@ -55,7 +55,11 @@ for resolutions.
'gc'::

This command is used to prune records of conflicted merge that
occurred long time ago.
occurred long time ago. By default, conflicts older than 15
days that you have not recorded their resolution, and conflicts
older than 60 days, are pruned. These are controlled with
`gc.rerereunresolved` and `gc.rerereresolved` configuration
variables.


DISCUSSION
Expand Down
13 changes: 13 additions & 0 deletions builtin-rerere.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,17 @@ static int do_plain_rerere(struct path_list *rr, int fd)
return write_rr(rr, fd);
}

static int git_rerere_config(const char *var, const char *value)
{
if (!strcmp(var, "gc.rerereresolved"))
cutoff_resolve = git_config_int(var, value);
else if (!strcmp(var, "gc.rerereunresolved"))
cutoff_noresolve = git_config_int(var, value);
else
return git_default_config(var, value);
return 0;
}

int cmd_rerere(int argc, const char **argv, const char *prefix)
{
struct path_list merge_rr = { NULL, 0, 0, 1 };
Expand All @@ -371,6 +382,8 @@ int cmd_rerere(int argc, const char **argv, const char *prefix)
if (stat(git_path("rr-cache"), &st) || !S_ISDIR(st.st_mode))
return 0;

git_config(git_rerere_config);

merge_rr_path = xstrdup(git_path("rr-cache/MERGE_RR"));
fd = hold_lock_file_for_update(&write_lock, merge_rr_path, 1);
read_rr(&merge_rr);
Expand Down

0 comments on commit 48c3242

Please sign in to comment.