summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-07-05 00:17:38 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-07-24 23:02:47 (GMT)
commitc7a25d3790bdbc486362084238db5a773f728570 (patch)
treed30f83d53c372c03b97e0156d559a944ec748261
parent8e7768b2de8bfdf82cde565d2f42e8d7f91e74e0 (diff)
downloadgit-c7a25d3790bdbc486362084238db5a773f728570.zip
git-c7a25d3790bdbc486362084238db5a773f728570.tar.gz
git-c7a25d3790bdbc486362084238db5a773f728570.tar.bz2
rerere: further de-dent do_plain_rerere()
It's just easier to follow this way. Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--rerere.c65
1 files changed, 33 insertions, 32 deletions
diff --git a/rerere.c b/rerere.c
index 1d0f69d..7b4028c 100644
--- a/rerere.c
+++ b/rerere.c
@@ -682,42 +682,43 @@ static int do_plain_rerere(struct string_list *rr, int fd)
* initial run would catch all and register their preimages.
*/
for (i = 0; i < conflict.nr; i++) {
+ unsigned char sha1[20];
+ char *hex;
+ int ret;
const char *path = conflict.items[i].string;
- if (!string_list_has_string(rr, path)) {
- unsigned char sha1[20];
- char *hex;
- int ret;
- /*
- * Ask handle_file() to scan and assign a
- * conflict ID. No need to write anything out
- * yet.
- */
- ret = handle_file(path, sha1, NULL);
- if (ret < 1)
- continue;
- hex = xstrdup(sha1_to_hex(sha1));
- string_list_insert(rr, path)->util = hex;
+ if (string_list_has_string(rr, path))
+ continue;
- /*
- * If the directory does not exist, create
- * it. mkdir_in_gitdir() will fail with
- * EEXIST if there already is one.
- *
- * NEEDSWORK: make sure "gc" does not remove
- * preimage without removing the directory.
- */
- if (mkdir_in_gitdir(git_path("rr-cache/%s", hex)))
- continue;
+ /*
+ * Ask handle_file() to scan and assign a
+ * conflict ID. No need to write anything out
+ * yet.
+ */
+ ret = handle_file(path, sha1, NULL);
+ if (ret < 1)
+ continue;
+ hex = xstrdup(sha1_to_hex(sha1));
+ string_list_insert(rr, path)->util = hex;
- /*
- * 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(hex, "preimage"));
- fprintf(stderr, "Recorded preimage for '%s'\n", path);
- }
+ /*
+ * If the directory does not exist, create
+ * it. mkdir_in_gitdir() will fail with
+ * EEXIST if there already is one.
+ *
+ * NEEDSWORK: make sure "gc" does not remove
+ * preimage without removing the directory.
+ */
+ if (mkdir_in_gitdir(git_path("rr-cache/%s", hex)))
+ continue;
+
+ /*
+ * 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(hex, "preimage"));
+ fprintf(stderr, "Recorded preimage for '%s'\n", path);
}
for (i = 0; i < rr->nr; i++)