diff mbox series

[v3,02/23] read-cache.c: remove 'const' from index_has_changes()

Message ID 20180909085418.31531-3-pclouds@gmail.com (mailing list archive)
State New, archived
Headers show
Series [v3,01/23] archive.c: remove implicit dependency the_repository | expand

Commit Message

Duy Nguyen Sept. 9, 2018, 8:53 a.m. UTC
This function calls do_diff_cache() which eventually needs to set this
"istate" to unpack_options->src_index (*). This is an unfortunate fact
that unpack_trees() _will_ destroy src_index so we can't really pass a
const index_state there. Just remove 'const'.

(*) 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.
---
 cache.h      | 2 +-
 read-cache.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/cache.h b/cache.h
index 4d014541ab..260e4ee44a 100644
--- a/cache.h
+++ b/cache.h
@@ -703,7 +703,7 @@  extern int unmerged_index(const struct index_state *);
  * provided, the space-separated list of files that differ will be appended
  * to it.
  */
-extern int index_has_changes(const struct index_state *istate,
+extern int index_has_changes(struct index_state *istate,
 			     struct tree *tree,
 			     struct strbuf *sb);
 
diff --git a/read-cache.c b/read-cache.c
index 7b1354d759..86134e56a6 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -2122,7 +2122,7 @@  int unmerged_index(const struct index_state *istate)
 	return 0;
 }
 
-int index_has_changes(const struct index_state *istate,
+int index_has_changes(struct index_state *istate,
 		      struct tree *tree,
 		      struct strbuf *sb)
 {