read-cache.c: remove 'const' from index_has_changes()

This function calls do_diff_cache() which eventually needs to set this "istate" to unpack_options->src_index [1]. This is an unfortunate fact that unpack_trees() _will_ update [2] src_index so we can't really pass a const index_state there. Just remove 'const'. [1] Right now diff_cache() in diff-lib.c assigns the_index to src_index. But the plan is to get rid of the_index, so it should be 'istate' from here that gets assigned to src_index. [2] Some transient bits in the source index are touched. Optional extensions can also be removed. But other than that the source tree should still be valid. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Sep 21, 2018 at 17:57 UTC 92a1bf5a58920e5f1f51106f06cd9dc6d6eb6c43
2 files changed +2 -2
cache.h
+1 -1
@@ -703,7 +703,7 @@ extern int unmerged_index(const struct index_state *);
703 * provided, the space-separated list of files that differ will be appended
704 * to it.
705 */
706 -extern int index_has_changes(const struct index_state *istate,
706 +extern int index_has_changes(struct index_state *istate,
707 struct tree *tree,
708 struct strbuf *sb);
709
read-cache.c
+1 -1
@@ -2122,7 +2122,7 @@ int unmerged_index(const struct index_state *istate)
2122 return 0;
2123 }
2124
2125 -int index_has_changes(const struct index_state *istate,
2125 +int index_has_changes(struct index_state *istate,
2126 struct tree *tree,
2127 struct strbuf *sb)
2128 {