зеркало из https://github.com/microsoft/git.git
merge-recursive: Structure process_df_entry() to handle more cases
Modify process_df_entry() (mostly just indentation level changes) to get it ready for handling more D/F conflict type cases. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
384c166807
Коммит
9c0bbb50f0
|
@ -1336,10 +1336,16 @@ static int process_entry(struct merge_options *o,
|
|||
}
|
||||
|
||||
/*
|
||||
* Per entry merge function for D/F conflicts, to be called only after
|
||||
* all files below dir have been processed. We do this because in the
|
||||
* cases we can cleanly resolve D/F conflicts, process_entry() can clean
|
||||
* out all the files below the directory for us.
|
||||
* Per entry merge function for D/F (and/or rename) conflicts. In the
|
||||
* cases we can cleanly resolve D/F conflicts, process_entry() can
|
||||
* clean out all the files below the directory for us. All D/F
|
||||
* conflict cases must be handled here at the end to make sure any
|
||||
* directories that can be cleaned out, are.
|
||||
*
|
||||
* Some rename conflicts may also be handled here that don't necessarily
|
||||
* involve D/F conflicts, since the code to handle them is generic enough
|
||||
* to handle those rename conflicts with or without D/F conflicts also
|
||||
* being involved.
|
||||
*/
|
||||
static int process_df_entry(struct merge_options *o,
|
||||
const char *path, struct stage_data *entry)
|
||||
|
@ -1351,17 +1357,18 @@ static int process_df_entry(struct merge_options *o,
|
|||
unsigned char *o_sha = stage_sha(entry->stages[1].sha, o_mode);
|
||||
unsigned char *a_sha = stage_sha(entry->stages[2].sha, a_mode);
|
||||
unsigned char *b_sha = stage_sha(entry->stages[3].sha, b_mode);
|
||||
struct stat st;
|
||||
|
||||
entry->processed = 1;
|
||||
if (entry->rename_df_conflict_info) {
|
||||
die("Not yet implemented.");
|
||||
} else if (!o_sha && !!a_sha != !!b_sha) {
|
||||
/* directory -> (directory, file) */
|
||||
const char *add_branch;
|
||||
const char *other_branch;
|
||||
unsigned mode;
|
||||
const unsigned char *sha;
|
||||
const char *conf;
|
||||
struct stat st;
|
||||
|
||||
if (!((!o_sha && a_sha && !b_sha) || (!o_sha && !a_sha && b_sha)))
|
||||
return 1; /* we don't handle non D-F cases */
|
||||
|
||||
entry->processed = 1;
|
||||
|
||||
if (a_sha) {
|
||||
add_branch = o->branch1;
|
||||
|
@ -1388,6 +1395,10 @@ static int process_df_entry(struct merge_options *o,
|
|||
output(o, 2, "Adding %s", path);
|
||||
update_file(o, 1, sha, mode, path);
|
||||
}
|
||||
} else {
|
||||
entry->processed = 0;
|
||||
return 1; /* not handled; assume clean until processed */
|
||||
}
|
||||
|
||||
return clean_merge;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче