rerere: further de-dent do_plain_rerere()
It's just easier to follow this way. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jul 4, 2015 at 17:17 UTC
c7a25d3790bdbc486362084238db5a773f728570
1 file changed
+33
-32
rerere.c
+33
-32
@@ -682,42 +682,43 @@ static int do_plain_rerere(struct string_list *rr, int fd)
682
* initial run would catch all and register their preimages.
683
*/
684
for (i = 0; i < conflict.nr; i++) {
685
+ unsigned char sha1[20];
686
+ char *hex;
687
+ int ret;
688
const char *path = conflict.items[i].string;
686
- if (!string_list_has_string(rr, path)) {
687
- unsigned char sha1[20];
688
- char *hex;
689
- int ret;
689
691
- /*
692
- * Ask handle_file() to scan and assign a
693
- * conflict ID. No need to write anything out
694
- * yet.
695
- */
696
- ret = handle_file(path, sha1, NULL);
697
- if (ret < 1)
698
- continue;
699
- hex = xstrdup(sha1_to_hex(sha1));
700
- string_list_insert(rr, path)->util = hex;
690
+ if (string_list_has_string(rr, path))
691
+ continue;
692
702
- /*
703
- * If the directory does not exist, create
704
- * it. mkdir_in_gitdir() will fail with
705
- * EEXIST if there already is one.
706
- *
707
- * NEEDSWORK: make sure "gc" does not remove
708
- * preimage without removing the directory.
709
- */
710
- if (mkdir_in_gitdir(git_path("rr-cache/%s", hex)))
711
- continue;
693
+ /*
694
+ * Ask handle_file() to scan and assign a
695
+ * conflict ID. No need to write anything out
696
+ * yet.
697
+ */
698
+ ret = handle_file(path, sha1, NULL);
699
+ if (ret < 1)
700
+ continue;
701
+ hex = xstrdup(sha1_to_hex(sha1));
702
+ string_list_insert(rr, path)->util = hex;
703
713
- /*
714
- * We are the first to encounter this
715
- * conflict. Ask handle_file() to write the
716
- * normalized contents to the "preimage" file.
717
- */
718
- handle_file(path, NULL, rerere_path(hex, "preimage"));
719
- fprintf(stderr, "Recorded preimage for '%s'\n", path);
720
- }
704
+ /*
705
+ * If the directory does not exist, create
706
+ * it. mkdir_in_gitdir() will fail with
707
+ * EEXIST if there already is one.
708
+ *
709
+ * NEEDSWORK: make sure "gc" does not remove
710
+ * preimage without removing the directory.
711
+ */
712
+ if (mkdir_in_gitdir(git_path("rr-cache/%s", hex)))
713
+ continue;
714
+
715
+ /*
716
+ * We are the first to encounter this
717
+ * conflict. Ask handle_file() to write the
718
+ * normalized contents to the "preimage" file.
719
+ */
720
+ handle_file(path, NULL, rerere_path(hex, "preimage"));
721
+ fprintf(stderr, "Recorded preimage for '%s'\n", path);
722
}
723
724
for (i = 0; i < rr->nr; i++)