- /*
- * We are the first to encounter this
- * conflict. Ask handle_file() to write the
- * normalized contents to the "preimage" file.
- */
- handle_file(path, NULL, rerere_path(id, "preimage"));
- id->collection->status |= RR_HAS_PREIMAGE;
- fprintf(stderr, "Recorded preimage for '%s'\n", path);
+ if (id->collection->status & RR_HAS_PREIMAGE) {
+ ;
+ } else {
+ /*
+ * We are the first to encounter this
+ * conflict. Ask handle_file() to write the
+ * normalized contents to the "preimage" file.
+ *
+ * NEEDSWORK: what should happen if we had a
+ * leftover postimage that is totally
+ * unrelated? Perhaps we should unlink it?
+ */
+ handle_file(path, NULL, rerere_path(id, "preimage"));
+ id->collection->status |= RR_HAS_PREIMAGE;
+ fprintf(stderr, "Recorded preimage for '%s'\n", path);
+ }