diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-08-03 00:30:44 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-03 00:30:45 +0200 |
commit | c18ac30e9ebcf7b7e2fbd992744e63c71089a12a (patch) | |
tree | 5eb5c1185b0d8bce39356abd801f0a9d7bf802ab /merge.c | |
parent | Merge branch 'js/rebase-merge-octopus' (diff) | |
parent | merge: fix misleading pre-merge check documentation (diff) | |
download | git-c18ac30e9ebcf7b7e2fbd992744e63c71089a12a.tar.xz git-c18ac30e9ebcf7b7e2fbd992744e63c71089a12a.zip |
Merge branch 'en/dirty-merge-fixes'
The recursive merge strategy did not properly ensure there was no
change between HEAD and the index before performing its operation,
which has been corrected.
* en/dirty-merge-fixes:
merge: fix misleading pre-merge check documentation
merge-recursive: enforce rule that index matches head before merging
t6044: add more testcases with staged changes before a merge is invoked
merge-recursive: fix assumption that head tree being merged is HEAD
merge-recursive: make sure when we say we abort that we actually abort
t6044: add a testcase for index matching head, when head doesn't match HEAD
t6044: verify that merges expected to abort actually abort
index_has_changes(): avoid assuming operating on the_index
read-cache.c: move index_has_changes() from merge.c
Diffstat (limited to 'merge.c')
-rw-r--r-- | merge.c | 31 |
1 files changed, 0 insertions, 31 deletions
@@ -14,37 +14,6 @@ static const char *merge_argument(struct commit *commit) return oid_to_hex(commit ? &commit->object.oid : the_hash_algo->empty_tree); } -int index_has_changes(struct strbuf *sb) -{ - struct object_id head; - int i; - - if (!get_oid_tree("HEAD", &head)) { - struct diff_options opt; - - diff_setup(&opt); - opt.flags.exit_with_status = 1; - if (!sb) - opt.flags.quick = 1; - do_diff_cache(&head, &opt); - diffcore_std(&opt); - for (i = 0; sb && i < diff_queued_diff.nr; i++) { - if (i) - strbuf_addch(sb, ' '); - strbuf_addstr(sb, diff_queued_diff.queue[i]->two->path); - } - diff_flush(&opt); - return opt.flags.has_changes != 0; - } else { - for (i = 0; sb && i < active_nr; i++) { - if (i) - strbuf_addch(sb, ' '); - strbuf_addstr(sb, active_cache[i]->name); - } - return !!active_nr; - } -} - int try_merge_command(const char *strategy, size_t xopts_nr, const char **xopts, struct commit_list *common, const char *head_arg, struct commit_list *remotes) |