gc.rerereResolved::
Records of conflicted merge you resolved earlier are
kept for this many days when 'git rerere gc' is run.
+ You can also use more human-readable "1.month.ago", etc.
The default is 60 days. See linkgit: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.
+ You can also use more human-readable "1.month.ago", etc.
The default is 15 days. See linkgit:git-rerere[1].
gitcvs.commitMsgAnnotation::
return ret;
}
+int git_config_get_expiry_in_days(const char *key, timestamp_t *expiry, timestamp_t now)
+{
+ char *expiry_string;
+ intmax_t days;
+ timestamp_t when;
+
+ if (git_config_get_string(key, &expiry_string))
+ return 1; /* no such thing */
+
+ if (git_parse_signed(expiry_string, &days, maximum_signed_value_of_type(int))) {
+ const int scale = 86400;
+ *expiry = now - days * scale;
+ return 0;
+ }
+
+ if (!parse_expiry_date(expiry_string, &when)) {
+ *expiry = when;
+ return 0;
+ }
+ return -1; /* thing exists but cannot be parsed */
+}
+
int git_config_get_untracked_cache(void)
{
int val = -1;
/* This dies if the configured or default date is in the future */
extern int git_config_get_expiry(const char *key, const char **output);
+/* parse either "this many days" integer, or "5.days.ago" approxidate */
+extern int git_config_get_expiry_in_days(const char *key, timestamp_t *, timestamp_t now);
+
struct key_value_info {
const char *filename;
int linenr;
unlink_rr_item(id);
}
-static void config_get_expiry(const char *key, timestamp_t *cutoff, timestamp_t now)
-{
- int days;
-
- if (!git_config_get_int(key, &days)) {
- const int scale = 86400;
- *cutoff = now - days * scale;
- }
-}
-
void rerere_gc(struct string_list *rr)
{
struct string_list to_remove = STRING_LIST_INIT_DUP;
if (setup_rerere(rr, 0) < 0)
return;
- config_get_expiry("gc.rerereresolved", &cutoff_resolve, now);
- config_get_expiry("gc.rerereunresolved", &cutoff_noresolve, now);
+ git_config_get_expiry_in_days("gc.rerereresolved", &cutoff_resolve, now);
+ git_config_get_expiry_in_days("gc.rerereunresolved", &cutoff_noresolve, now);
git_config(git_default_config, NULL);
dir = opendir(git_path("rr-cache"));
if (!dir)
rerere_gc_custom_expiry_test 5 0
+rerere_gc_custom_expiry_test 5.days.ago now
+
test_expect_success 'setup: file2 added differently in two branches' '
git reset --hard &&