X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=rerere.c;h=1d951617ee2f92676a6e3ff4b809b716481a7847;hb=9904fadfea002edf2ef22e8ec9a978e45d1f540b;hp=2197890982e55d7ff0832b6c59b6661874fa4223;hpb=762655010d6f051f632a77b8c5b95b9f5cad02c9;p=git.git diff --git a/rerere.c b/rerere.c index 219789098..1d951617e 100644 --- a/rerere.c +++ b/rerere.c @@ -46,7 +46,7 @@ static void read_rr(struct string_list *rr) ; /* do nothing */ if (i == sizeof(buf)) die("filename too long"); - string_list_insert(buf, rr)->util = name; + string_list_insert(rr, buf)->util = name; } fclose(in); } @@ -354,7 +354,7 @@ static int find_conflict(struct string_list *conflict) ce_same_name(e2, e3) && S_ISREG(e2->ce_mode) && S_ISREG(e3->ce_mode)) { - string_list_insert((const char *)e2->name, conflict); + string_list_insert(conflict, (const char *)e2->name); i++; /* skip over both #2 and #3 */ } } @@ -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)); @@ -449,7 +455,7 @@ static int do_plain_rerere(struct string_list *rr, int fd) if (ret < 1) continue; hex = xstrdup(sha1_to_hex(sha1)); - string_list_insert(path, rr)->util = hex; + string_list_insert(rr, path)->util = hex; if (mkdir(git_path("rr-cache/%s", hex), 0755)) continue; handle_file(path, NULL, rerere_path(hex, "preimage")); @@ -471,7 +477,7 @@ static int do_plain_rerere(struct string_list *rr, int fd) if (has_rerere_resolution(name)) { if (!merge(name, path)) { if (rerere_autoupdate) - string_list_insert(path, &update); + string_list_insert(&update, path); fprintf(stderr, "%s '%s' using previous resolution.\n", rerere_autoupdate @@ -577,7 +583,7 @@ static int rerere_forget_one_path(const char *path, struct string_list *rr) fprintf(stderr, "Updated preimage for '%s'\n", path); - string_list_insert(path, rr)->util = hex; + string_list_insert(rr, path)->util = hex; fprintf(stderr, "Forgot resolution for %s\n", path); return 0; }