summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2018-07-01 01:25:00 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-07-11 16:38:36 (GMT)
commite1f8694f3394caf3d3cd57c6c7593f0b0cdb1f9e (patch)
treedd07179f9af2ebd29a518d3553ea061ceb099b77 /cache.h
parent92702392cefdbd66ca593fa909540230ef9e005e (diff)
downloadgit-e1f8694f3394caf3d3cd57c6c7593f0b0cdb1f9e.zip
git-e1f8694f3394caf3d3cd57c6c7593f0b0cdb1f9e.tar.gz
git-e1f8694f3394caf3d3cd57c6c7593f0b0cdb1f9e.tar.bz2
merge-recursive: fix assumption that head tree being merged is HEAD
`git merge-recursive` does a three-way merge between user-specified trees base, head, and remote. Since the user is allowed to specify head, we can not necesarily assume that head == HEAD. Modify index_has_changes() to take an extra argument specifying the tree to compare against. If NULL, it will compare to HEAD. We then use this from merge-recursive to make sure we compare to the user-specified head. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/cache.h b/cache.h
index 169c809..fad10c3 100644
--- a/cache.h
+++ b/cache.h
@@ -218,6 +218,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
@@ -627,12 +628,14 @@ extern void move_index_extensions(struct index_state *dst, struct index_state *s
extern int unmerged_index(const struct index_state *);
/**
- * Returns 1 if istate differs from HEAD, 0 otherwise. When 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.
+ * 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);