static int get_files_dirs(struct merge_options *o, struct tree *tree)
{
int n;
- if (read_tree_recursive(tree, "", 0, 0, NULL, save_files_dirs, o))
+ struct pathspec match_all;
+ init_pathspec(&match_all, NULL);
+ if (read_tree_recursive(tree, "", 0, 0, &match_all, save_files_dirs, o))
return 0;
n = o->current_file_set.nr + o->current_directory_set.nr;
return n;
* and the file need to be present, then the D/F file will be
* reinstated with a new unique name at the time it is processed.
*/
+ struct string_list df_sorted_entries;
const char *last_file = NULL;
int last_len = 0;
int i;
return;
/* Ensure D/F conflicts are adjacent in the entries list. */
- qsort(entries->items, entries->nr, sizeof(*entries->items),
+ memset(&df_sorted_entries, 0, sizeof(struct string_list));
+ for (i = 0; i < entries->nr; i++) {
+ struct string_list_item *next = &entries->items[i];
+ string_list_append(&df_sorted_entries, next->string)->util =
+ next->util;
+ }
+ qsort(df_sorted_entries.items, entries->nr, sizeof(*entries->items),
string_list_df_name_compare);
string_list_clear(&o->df_conflict_file_set, 1);
- for (i = 0; i < entries->nr; i++) {
- const char *path = entries->items[i].string;
+ for (i = 0; i < df_sorted_entries.nr; i++) {
+ const char *path = df_sorted_entries.items[i].string;
int len = strlen(path);
- struct stage_data *e = entries->items[i].util;
+ struct stage_data *e = df_sorted_entries.items[i].util;
/*
* Check if last_file & path correspond to a D/F conflict;
last_file = NULL;
}
}
+ string_list_clear(&df_sorted_entries, 0);
}
struct rename {
path_renamed_outside_HEAD = !path2 || !strcmp(path, path2);
if (!path_renamed_outside_HEAD) {
add_cacheinfo(mfi.mode, mfi.sha, path,
- 0 /*stage*/, 1 /*refresh*/, 0 /*options*/);
+ 0, (!o->call_depth), 0);
return mfi.clean;
}
} else
merged_common_ancestors = pop_commit(&ca);
if (merged_common_ancestors == NULL) {
- /* if there is no common ancestor, make an empty tree */
- struct tree *tree = xcalloc(1, sizeof(struct tree));
+ /* if there is no common ancestor, use an empty tree */
+ struct tree *tree;
- tree->object.parsed = 1;
- tree->object.type = OBJ_TREE;
- pretend_sha1_file(NULL, 0, OBJ_TREE, tree->object.sha1);
+ tree = lookup_tree((const unsigned char *)EMPTY_TREE_SHA1_BIN);
merged_common_ancestors = make_virtual_commit(tree, "ancestor");
}
o->subtree_shift = s + strlen("subtree=");
else if (!strcmp(s, "patience"))
o->xdl_opts |= XDF_PATIENCE_DIFF;
+ else if (!strcmp(s, "histogram"))
+ o->xdl_opts |= XDF_HISTOGRAM_DIFF;
else if (!strcmp(s, "ignore-space-change"))
o->xdl_opts |= XDF_IGNORE_WHITESPACE_CHANGE;
else if (!strcmp(s, "ignore-all-space"))