@matheusbsbs / matheus-bagliano / commits / 48c3242450
Fork 0

rerere gc: honor configuration and document it

Two configuration to control the expiration of rerere records are introduced and documented. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Dec 27, 2006 at 01:24 UTC 48c3242450fe5fb18e6890812c000ed5c6291a98
3 files changed +29 -2
Documentation/config.txt
+10
@@ -192,6 +192,16 @@ format.headers::
192 Additional email headers to include in a patch to be submitted
193 by mail. See gitlink:git-format-patch[1].
194
195 +gc.rerereresolved::
196 + Records of conflicted merge you resolved earlier are
197 + kept for this many days when `git rerere gc` is run.
198 + The default is 60 days. See gitlink:git-rerere[1].
199 +
200 +gc.rerereunresolved::
201 + Records of conflicted merge you have not resolved are
202 + kept for this many days when `git rerere gc` is run.
203 + The default is 15 days. See gitlink:git-rerere[1].
204 +
205 gitcvs.enabled::
206 Whether the cvs pserver interface is enabled for this repository.
207 See gitlink:git-cvsserver[1].
Documentation/git-rerere.txt
+6 -2
@@ -7,7 +7,7 @@ git-rerere - Reuse recorded resolve
7
8 SYNOPSIS
9 --------
10 -'git-rerere' [clear|diff|status]
10 +'git-rerere' [clear|diff|status|gc]
11
12 DESCRIPTION
13 -----------
@@ -55,7 +55,11 @@ for resolutions.
55 'gc'::
56
57 This command is used to prune records of conflicted merge that
58 -occurred long time ago.
58 +occurred long time ago. By default, conflicts older than 15
59 +days that you have not recorded their resolution, and conflicts
60 +older than 60 days, are pruned. These are controlled with
61 +`gc.rerereunresolved` and `gc.rerereresolved` configuration
62 +variables.
63
64
65 DISCUSSION
builtin-rerere.c
+13
@@ -362,6 +362,17 @@ tail_optimization:
362 return write_rr(rr, fd);
363 }
364
365 +static int git_rerere_config(const char *var, const char *value)
366 +{
367 + if (!strcmp(var, "gc.rerereresolved"))
368 + cutoff_resolve = git_config_int(var, value);
369 + else if (!strcmp(var, "gc.rerereunresolved"))
370 + cutoff_noresolve = git_config_int(var, value);
371 + else
372 + return git_default_config(var, value);
373 + return 0;
374 +}
375 +
376 int cmd_rerere(int argc, const char **argv, const char *prefix)
377 {
378 struct path_list merge_rr = { NULL, 0, 0, 1 };
@@ -371,6 +382,8 @@ int cmd_rerere(int argc, const char **argv, const char *prefix)
382 if (stat(git_path("rr-cache"), &st) || !S_ISDIR(st.st_mode))
383 return 0;
384
385 + git_config(git_rerere_config);
386 +
387 merge_rr_path = xstrdup(git_path("rr-cache/MERGE_RR"));
388 fd = hold_lock_file_for_update(&write_lock, merge_rr_path, 1);
389 read_rr(&merge_rr);