From: Junio C Hamano Date: Tue, 9 Jan 2018 18:41:37 +0000 (-0800) Subject: Merge branch 'ew/empty-merge-with-dirty-index-maint' into ew/empty-merge-with-dirty-index X-Git-Tag: v2.16.0-rc2~6^2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/5b1c54ac99e6847eaff409cd6fb328fd0f8d9076?hp=-c Merge branch 'ew/empty-merge-with-dirty-index-maint' into ew/empty-merge-with-dirty-index * ew/empty-merge-with-dirty-index-maint: merge-recursive: do not look at the index during recursive merge --- 5b1c54ac99e6847eaff409cd6fb328fd0f8d9076 diff --combined merge-recursive.c index 780f81a8bd,c571778f96..0fc580d8ca --- a/merge-recursive.c +++ b/merge-recursive.c @@@ -540,8 -540,8 +540,8 @@@ static struct string_list *get_renames( return renames; diff_setup(&opts); - DIFF_OPT_SET(&opts, RECURSIVE); - DIFF_OPT_CLR(&opts, RENAME_EMPTY); + opts.flags.recursive = 1; + opts.flags.rename_empty = 0; opts.detect_rename = DIFF_DETECT_RENAME; opts.rename_limit = o->merge_rename_limit >= 0 ? o->merge_rename_limit : o->diff_rename_limit >= 0 ? o->diff_rename_limit : @@@ -646,7 -646,7 +646,7 @@@ static int remove_file(struct merge_opt if (ignore_case) { struct cache_entry *ce; ce = cache_file_exists(path, strlen(path), ignore_case); - if (ce && ce_stage(ce) == 0) + if (ce && ce_stage(ce) == 0 && strcmp(path, ce->name)) return 0; } if (remove_path(path)) @@@ -1954,7 -1954,7 +1954,7 @@@ int merge_trees(struct merge_options *o if (oid_eq(&common->object.oid, &merge->object.oid)) { struct strbuf sb = STRBUF_INIT; - if (index_has_changes(&sb)) { + if (!o->call_depth && index_has_changes(&sb)) { err(o, _("Dirty index: cannot merge (dirty: %s)"), sb.buf); return 0; @@@ -2089,7 -2089,7 +2089,7 @@@ int merge_recursive(struct merge_option /* if there is no common ancestor, use an empty tree */ struct tree *tree; - tree = lookup_tree(&empty_tree_oid); + tree = lookup_tree(the_hash_algo->empty_tree); merged_common_ancestors = make_virtual_commit(tree, "ancestor"); } @@@ -2170,7 -2170,7 +2170,7 @@@ int merge_recursive_generic(struct merg struct commit **result) { int clean; - struct lock_file *lock = xcalloc(1, sizeof(struct lock_file)); + struct lock_file lock = LOCK_INIT; struct commit *head_commit = get_ref(head, o->branch1); struct commit *next_commit = get_ref(merge, o->branch2); struct commit_list *ca = NULL; @@@ -2186,14 -2186,14 +2186,14 @@@ } } - hold_locked_index(lock, LOCK_DIE_ON_ERROR); + hold_locked_index(&lock, LOCK_DIE_ON_ERROR); clean = merge_recursive(o, head_commit, next_commit, ca, result); if (clean < 0) return clean; if (active_cache_changed && - write_locked_index(&the_index, lock, COMMIT_LOCK)) + write_locked_index(&the_index, &lock, COMMIT_LOCK)) return err(o, _("Unable to write index.")); return clean ? 0 : 1; @@@ -2209,7 -2209,6 +2209,7 @@@ static void merge_recursive_config(stru void init_merge_options(struct merge_options *o) { + const char *merge_verbosity; memset(o, 0, sizeof(struct merge_options)); o->verbosity = 2; o->buffer_output = 1; @@@ -2218,9 -2217,9 +2218,9 @@@ o->renormalize = 0; o->detect_rename = 1; merge_recursive_config(o); - if (getenv("GIT_MERGE_VERBOSITY")) - o->verbosity = - strtol(getenv("GIT_MERGE_VERBOSITY"), NULL, 10); + merge_verbosity = getenv("GIT_MERGE_VERBOSITY"); + if (merge_verbosity) + o->verbosity = strtol(merge_verbosity, NULL, 10); if (o->verbosity >= 5) o->buffer_output = 0; strbuf_init(&o->obuf, 0); @@@ -2260,8 -2259,6 +2260,8 @@@ int parse_merge_opt(struct merge_option DIFF_XDL_SET(o, IGNORE_WHITESPACE); else if (!strcmp(s, "ignore-space-at-eol")) DIFF_XDL_SET(o, IGNORE_WHITESPACE_AT_EOL); + else if (!strcmp(s, "ignore-cr-at-eol")) + DIFF_XDL_SET(o, IGNORE_CR_AT_EOL); else if (!strcmp(s, "renormalize")) o->renormalize = 1; else if (!strcmp(s, "no-renormalize"))