[WIP PATCH 03/10] A bunch of fixes and FIXMEs
---
merge-recursive.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/merge-recursive.c b/merge-recursive.c
index 8d28a54..fde9f9e 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -910,7 +910,8 @@ static void conflict_rename_rename_1to2(struct merge_options *o,
if (o->call_depth) {
/*
* FIXME: This is bogus. dst_nameX are not in cache in
- * case of D/F conflict.
+ * case of D/F conflict. renX_dst are. Simple typo, or
+ * something worse?
*/
remove_file_from_cache(dst_name1);
remove_file_from_cache(dst_name2);
@@ -1290,10 +1291,12 @@ static int merge_content(struct merge_options *o,
const char *new_path;
update_file_flags(o, mfi.sha, mfi.mode, path,
o->call_depth || mfi.clean, 0);
- new_path = unique_path(o, path, df_rename_conflict_branch);
mfi.clean = 0;
- output(o, 1, "Adding as %s instead", new_path);
- update_file_flags(o, mfi.sha, mfi.mode, new_path, 0, 1);
+ if (!o->call_depth) {
+ new_path = unique_path(o, path, df_rename_conflict_branch);
+ output(o, 1, "Adding as %s instead", new_path);
+ update_file(o, mfi.clean, mfi.sha, mfi.mode, new_path);
+ }
} else {
update_file(o, mfi.clean, mfi.sha, mfi.mode, path);
}
@@ -1433,6 +1436,11 @@ static int process_df_entry(struct merge_options *o,
src, conflict_info->pair2->two->path, conflict_info->branch2,
o->call_depth ? " (left unresolved)" : "");
if (o->call_depth) {
+ /*
+ * FIXME: Why remove file from cache, and
+ * then immediately readd it? Why not just
+ * overwrite using update_file only?
+ */
remove_file_from_cache(src);
update_file(o, 0, conflict_info->pair1->one->sha1,
conflict_info->pair1->one->mode, src);
--
1.7.4