git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Sep 15, 2018, 16:17 UTC
Message-ID
<20180915161759.8272-3-pclouds@gmail.com>
In-Reply-To
<20180915161759.8272-1-pclouds@gmail.com>

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.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 cache.h      | 2 +-
 read-cache.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
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)
 {
-- 
2.19.0.rc0.337.ge906d732e7
Previous: Nguyễn Thái Ngọc DuyNext: Junio C Hamano
Message 106 of 160 in “Kill the_index part 4”
  1. 00/21 Kill the_index part 4Nguyễn Thái Ngọc Duy, Aug 26, 2018
  2. 01/21 archive.c: remove implicit dependency the_repositoryNguyễn Thái Ngọc Duy, Aug 26, 2018
  3. 03/21 combine-diff.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Aug 26, 2018
  4. 04/21 diff.c: remove the_index dependency in textconv() functionsNguyễn Thái Ngọc Duy, Aug 26, 2018
  5. 02/21 read-cache.c: remove 'const' from index_has_changes()Nguyễn Thái Ngọc Duy, Aug 26, 2018
  6. Stefan BellerAug 27, 2018
  7. Duy NguyenAug 28, 2018
  8. Stefan BellerAug 28, 2018
  9. 05/21 grep.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Aug 26, 2018
  10. 07/21 read-cache.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Aug 26, 2018
  11. 06/21 diff.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Aug 26, 2018
  12. 10/21 merge-blobs.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Aug 26, 2018
  13. 09/21 ll-merge.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Aug 26, 2018
  14. 12/21 patch-ids.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Aug 26, 2018
  15. Stefan BellerAug 27, 2018
  16. Duy NguyenSep 3, 2018
  17. Stefan BellerSep 4, 2018
  18. Duy NguyenSep 9, 2018
  19. Stefan BellerSep 10, 2018
  20. 08/21 diff-lib.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Aug 26, 2018
  21. 14/21 rerere.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Aug 26, 2018
  22. 16/21 line-range.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Aug 26, 2018
  23. 18/21 tree-diff.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Aug 26, 2018
  24. 15/21 userdiff.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Aug 26, 2018
  25. 17/21 submodule.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Aug 26, 2018
  26. 19/21 ws.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Aug 26, 2018
  27. 20/21 wt-status.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Aug 26, 2018
  28. 21/21 wt-status.c: remove implicit dependency the_repositoryNguyễn Thái Ngọc Duy, Aug 26, 2018
  29. 11/21 merge.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Aug 26, 2018
  30. 13/21 sha1-file.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Aug 26, 2018
  31. Stefan BellerAug 27, 2018
  32. Duy NguyenAug 28, 2018
  33. 00/24 Kill the_index part 4Nguyễn Thái Ngọc Duy, Sep 3, 2018
  34. 01/24 archive.c: remove implicit dependency the_repositoryNguyễn Thái Ngọc Duy, Sep 3, 2018
  35. 02/24 read-cache.c: remove 'const' from index_has_changes()Nguyễn Thái Ngọc Duy, Sep 3, 2018
  36. 04/24 combine-diff.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 3, 2018
  37. 03/24 diff.c: reduce implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 3, 2018
  38. 05/24 blame.c: rename "repo" argument to "r"Nguyễn Thái Ngọc Duy, Sep 3, 2018
  39. 06/24 diff.c: remove the_index dependency in textconv() functionsNguyễn Thái Ngọc Duy, Sep 3, 2018
  40. 07/24 grep.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 3, 2018
  41. 09/24 read-cache.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 3, 2018
  42. 08/24 diff.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 3, 2018
  43. 10/24 diff-lib.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 3, 2018
  44. 11/24 ll-merge.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 3, 2018
  45. 12/24 merge-blobs.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 3, 2018
  46. 13/24 merge.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 3, 2018
  47. 14/24 patch-ids.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 3, 2018
  48. 15/24 sha1-file.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 3, 2018
  49. 16/24 rerere.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 3, 2018
  50. 18/24 line-range.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 3, 2018
  51. 20/24 tree-diff.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 3, 2018
  52. 17/24 userdiff.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 3, 2018
  53. 19/24 submodule.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 3, 2018
  54. Jeff KingOct 19, 2018
  55. Duy NguyenOct 19, 2018
  56. Jeff KingOct 19, 2018
  57. Duy NguyenOct 19, 2018
  58. Jeff KingOct 19, 2018
  59. submodule.c: remove some of the_repository referencesNguyễn Thái Ngọc Duy, Oct 19, 2018
  60. Stefan BellerOct 19, 2018
  61. Duy NguyenOct 19, 2018
  62. Stefan BellerOct 19, 2018
  63. 21/24 ws.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 3, 2018
  64. 23/24 revision.c: reduce implicit dependency the_repositoryNguyễn Thái Ngọc Duy, Sep 3, 2018
  65. 22/24 revision.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 3, 2018
  66. Stefan BellerSep 4, 2018
  67. Junio C HamanoSep 4, 2018
  68. 24/24 Rename functions to avoid breaking in-flight topicsNguyễn Thái Ngọc Duy, Sep 3, 2018
  69. Stefan BellerSep 4, 2018
  70. Junio C HamanoSep 4, 2018
  71. Stefan BellerSep 4, 2018
  72. Junio C HamanoSep 5, 2018
  73. Duy NguyenSep 9, 2018
  74. Junio C HamanoSep 11, 2018
  75. 00/23 Kill the_index part 4Nguyễn Thái Ngọc Duy, Sep 9, 2018
  76. 01/23 archive.c: remove implicit dependency the_repositoryNguyễn Thái Ngọc Duy, Sep 9, 2018
  77. 02/23 read-cache.c: remove 'const' from index_has_changes()Nguyễn Thái Ngọc Duy, Sep 9, 2018
  78. 03/23 diff.c: reduce implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 9, 2018
  79. 04/23 combine-diff.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 9, 2018
  80. 06/23 diff.c: remove the_index dependency in textconv() functionsNguyễn Thái Ngọc Duy, Sep 9, 2018
  81. 05/23 blame.c: rename "repo" argument to "r"Nguyễn Thái Ngọc Duy, Sep 9, 2018
  82. 08/23 diff.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 9, 2018
  83. 09/23 read-cache.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 9, 2018
  84. 07/23 grep.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 9, 2018
  85. 13/23 merge.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 9, 2018
  86. 10/23 diff-lib.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 9, 2018
  87. 14/23 patch-ids.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 9, 2018
  88. Stefan BellerSep 10, 2018
  89. Junio C HamanoSep 10, 2018
  90. Duy NguyenSep 11, 2018
  91. 17/23 userdiff.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 9, 2018
  92. 18/23 line-range.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 9, 2018
  93. 16/23 rerere.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 9, 2018
  94. 15/23 sha1-file.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 9, 2018
  95. 21/23 ws.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 9, 2018
  96. 20/23 tree-diff.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 9, 2018
  97. 22/23 revision.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 9, 2018
  98. 23/23 revision.c: reduce implicit dependency the_repositoryNguyễn Thái Ngọc Duy, Sep 9, 2018
  99. 19/23 submodule.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 9, 2018
  100. 12/23 merge-blobs.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 9, 2018
  101. 11/23 ll-merge.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 9, 2018
  102. Junio C HamanoSep 11, 2018
  103. Stefan BellerSep 10, 2018
  104. 00/23 Kill the_index part 4Nguyễn Thái Ngọc Duy, Sep 15, 2018
  105. 01/23 archive.c: remove implicit dependency the_repositoryNguyễn Thái Ngọc Duy, Sep 15, 2018
  106. 02/23 read-cache.c: remove 'const' from index_has_changes()Nguyễn Thái Ngọc Duy, Sep 15, 2018
  107. Junio C HamanoSep 17, 2018
  108. Duy NguyenSep 17, 2018
  109. Junio C HamanoSep 17, 2018
  110. 04/23 combine-diff.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 15, 2018
  111. 05/23 blame.c: rename "repo" argument to "r"Nguyễn Thái Ngọc Duy, Sep 15, 2018
  112. Junio C HamanoSep 17, 2018
  113. 03/23 diff.c: reduce implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 15, 2018
  114. 06/23 diff.c: remove the_index dependency in textconv() functionsNguyễn Thái Ngọc Duy, Sep 15, 2018
  115. 07/23 grep.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 15, 2018
  116. 09/23 read-cache.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 15, 2018
  117. 08/23 diff.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 15, 2018
  118. 11/23 ll-merge.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 15, 2018
  119. 10/23 diff-lib.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 15, 2018
  120. 12/23 merge-blobs.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 15, 2018
  121. 13/23 merge.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 15, 2018
  122. 14/23 patch-ids.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 15, 2018
  123. 15/23 sha1-file.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 15, 2018
  124. 16/23 rerere.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 15, 2018
  125. 18/23 line-range.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 15, 2018
  126. 17/23 userdiff.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 15, 2018
  127. 21/23 ws.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 15, 2018
  128. 20/23 tree-diff.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 15, 2018
  129. 22/23 revision.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 15, 2018
  130. 23/23 revision.c: reduce implicit dependency the_repositoryNguyễn Thái Ngọc Duy, Sep 15, 2018
  131. 19/23 submodule.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 15, 2018
  132. 00/23 Kill the_index part 4Nguyễn Thái Ngọc Duy, Sep 21, 2018
  133. 01/23 archive.c: remove implicit dependency the_repositoryNguyễn Thái Ngọc Duy, Sep 21, 2018
  134. 02/23 read-cache.c: remove 'const' from index_has_changes()Nguyễn Thái Ngọc Duy, Sep 21, 2018
  135. 04/23 combine-diff.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 21, 2018
  136. 05/23 blame.c: rename "repo" argument to "r"Nguyễn Thái Ngọc Duy, Sep 21, 2018
  137. 03/23 diff.c: reduce implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 21, 2018
  138. 06/23 diff.c: remove the_index dependency in textconv() functionsNguyễn Thái Ngọc Duy, Sep 21, 2018
  139. 07/23 grep.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 21, 2018
  140. 09/23 read-cache.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 21, 2018
  141. 08/23 diff.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 21, 2018
  142. 10/23 diff-lib.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 21, 2018
  143. 11/23 ll-merge.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 21, 2018
  144. 13/23 merge.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 21, 2018
  145. 12/23 merge-blobs.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 21, 2018
  146. 14/23 patch-ids.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 21, 2018
  147. 15/23 sha1-file.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 21, 2018
  148. 16/23 rerere.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 21, 2018
  149. 17/23 userdiff.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 21, 2018
  150. Junio C HamanoSep 21, 2018
  151. Jeff KingOct 10, 2018
  152. Junio C HamanoOct 10, 2018
  153. Jeff KingOct 11, 2018
  154. Duy NguyenOct 14, 2018
  155. 18/23 line-range.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 21, 2018
  156. 19/23 submodule.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 21, 2018
  157. 20/23 tree-diff.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 21, 2018
  158. 21/23 ws.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 21, 2018
  159. 23/23 revision.c: reduce implicit dependency the_repositoryNguyễn Thái Ngọc Duy, Sep 21, 2018
  160. 22/23 revision.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Sep 21, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.