@matheusbsbs / matheus-bagliano / commits / 7edba4c45c
Fork 0

merge-recursive: Restructure showing how to chain more process_* functions

In 3734893 (merge-recursive: Fix D/F conflicts 2010-07-09), process_df_entry() was added to process_renames() and process_entry() but in a somewhat restrictive manner. Modify the code slightly to make it clearer how we could chain more such functions if necessary, and alter process_df_entry() to handle such chaining. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Sep 20, 2010 at 02:28 UTC 7edba4c45c33ba1e17d88907c1601dc660a44522
1 file changed +8 -3
merge-recursive.c
+8 -3
@@ -1259,9 +1259,8 @@ static int process_df_entry(struct merge_options *o,
1259 const char *conf;
1260 struct stat st;
1261
1262 - /* We currently only handle D->F cases */
1263 - assert((!o_sha && a_sha && !b_sha) ||
1264 - (!o_sha && !a_sha && b_sha));
1262 + if (!((!o_sha && a_sha && !b_sha) || (!o_sha && !a_sha && b_sha)))
1263 + return 1; /* we don't handle non D-F cases */
1264
1265 entry->processed = 1;
1266
@@ -1350,6 +1349,12 @@ int merge_trees(struct merge_options *o,
1349 && !process_df_entry(o, path, e))
1350 clean = 0;
1351 }
1352 + for (i = 0; i < entries->nr; i++) {
1353 + struct stage_data *e = entries->items[i].util;
1354 + if (!e->processed)
1355 + die("Unprocessed path??? %s",
1356 + entries->items[i].string);
1357 + }
1358
1359 string_list_clear(re_merge, 0);
1360 string_list_clear(re_head, 0);