diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-08-03 01:30:44 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-03 01:30:45 +0300 |
commit | c18ac30e9ebcf7b7e2fbd992744e63c71089a12a (patch) | |
tree | 5eb5c1185b0d8bce39356abd801f0a9d7bf802ab /cache.h | |
parent | 2b9afea37207323d629953c639542c0e4c87e484 (diff) | |
parent | 55f39cf7551bd468065306328efdb78933b36b69 (diff) |
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 'cache.h')
-rw-r--r-- | cache.h | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -220,6 +220,7 @@ struct cache_entry { /* Forward structure decls */ struct pathspec; struct child_process; +struct tree; /* * Copy the sha1 and stat state of a cache entry from one to @@ -696,12 +697,15 @@ extern void move_index_extensions(struct index_state *dst, struct index_state *s extern int unmerged_index(const struct index_state *); /** - * Returns 1 if the index differs from HEAD, 0 otherwise. When on an unborn - * branch, returns 1 if there are entries in the index, 0 otherwise. If an - * strbuf is provided, the space-separated list of files that differ will be - * appended to it. - */ -extern int index_has_changes(struct strbuf *sb); + * Returns 1 if istate differs from tree, 0 otherwise. If tree is NULL, + * compares istate to HEAD. If tree is NULL and on an unborn branch, + * returns 1 if there are entries in istate, 0 otherwise. If an strbuf is + * provided, the space-separated list of files that differ will be appended + * to it. + */ +extern int index_has_changes(const struct index_state *istate, + struct tree *tree, + struct strbuf *sb); extern int verify_path(const char *path, unsigned mode); extern int strcmp_offset(const char *s1, const char *s2, size_t *first_change); |