aboutsummaryrefslogtreecommitdiffstats
path: root/rerere.c
diff options
context:
space:
mode:
authorSZEDER Gábor <szeder@ira.uka.de>2010-07-13 01:42:04 +0200
committerJunio C Hamano <gitster@pobox.com>2010-07-14 09:26:57 -0700
commit7d7ff15b39abfa9e73b6475f189006a74dc26376 (patch)
tree2607517d6a25a30d2163148b8d4bf9cf1722069f /rerere.c
parentded2d47668c8e865465a7ad69665696f9b56f24b (diff)
downloadgit-7d7ff15b39abfa9e73b6475f189006a74dc26376.tar.gz
rerere: fix overeager gc
'rerere gc' prunes resolutions of conflicted merges that occurred long time ago, and when doing so it takes the creation time of the conflicted automerge results into account. This can cause the loss of frequently used conflict resolutions (e.g. long-living topic branches are merged into a regularly rebuilt integration branch (think of git's pu)) when they become old enough to exceed 'rerere gc's threshold. To prevent the loss of valuable merge resolutions 'rerere' will (1) update the timestamp of the recorded conflict resolution (i.e. 'postimage') each time when encountering and resolving the same merge conflict, and (2) take this timestamp, i.e. the time of the last usage into account when gc'ing. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'rerere.c')
-rw-r--r--rerere.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/rerere.c b/rerere.c
index f221bed1e9..a6f6681e11 100644
--- a/rerere.c
+++ b/rerere.c
@@ -378,7 +378,13 @@ static int merge(const char *name, const char *path)
}
ret = ll_merge(&result, path, &base, NULL, &cur, "", &other, "", 0);
if (!ret) {
- FILE *f = fopen(path, "w");
+ FILE *f;
+
+ if (utime(rerere_path(name, "postimage"), NULL) < 0)
+ warning("failed utime() on %s: %s",
+ rerere_path(name, "postimage"),
+ strerror(errno));
+ f = fopen(path, "w");
if (!f)
return error("Could not open %s: %s", path,
strerror(errno));