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

[PATCH 05/12] update-index: use istate->cache over active_cache

From
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
Date
Jan 1, 2021, 13:07 UTC
Message-ID
<cc5df3566dfa015b57582fe76f3f6e940d549017.1609506428.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.830.git.1609506428.gitgitgadget@gmail.com>
From: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
---
 builtin/update-index.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/builtin/update-index.c b/builtin/update-index.c
index c9a6cde97da..0616c786410 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -235,12 +235,12 @@ static int mark_ce_flags(const char *path, int flag, int mark)
 	int namelen = strlen(path);
 	int pos = cache_name_pos(path, namelen);
 	if (0 <= pos) {
-		mark_fsmonitor_invalid(istate, active_cache[pos]);
+		mark_fsmonitor_invalid(istate, istate->cache[pos]);
 		if (mark)
-			active_cache[pos]->ce_flags |= flag;
+			istate->cache[pos]->ce_flags |= flag;
 		else
-			active_cache[pos]->ce_flags &= ~flag;
-		active_cache[pos]->ce_flags |= CE_UPDATE_IN_BASE;
+			istate->cache[pos]->ce_flags &= ~flag;
+		istate->cache[pos]->ce_flags |= CE_UPDATE_IN_BASE;
 		cache_tree_invalidate_path(istate, path);
 		active_cache_changed |= CE_ENTRY_CHANGED;
 		return 0;
@@ -331,7 +331,7 @@ static int process_directory(const char *path, int len, struct stat *st)
 
 	/* Exact match: file or existing gitlink */
 	if (pos >= 0) {
-		const struct cache_entry *ce = active_cache[pos];
+		const struct cache_entry *ce = istate->cache[pos];
 		if (S_ISGITLINK(ce->ce_mode)) {
 
 			/* Do nothing to the index if there is no HEAD! */
@@ -347,7 +347,7 @@ static int process_directory(const char *path, int len, struct stat *st)
 	/* Inexact match: is there perhaps a subdirectory match? */
 	pos = -pos-1;
 	while (pos < active_nr) {
-		const struct cache_entry *ce = active_cache[pos++];
+		const struct cache_entry *ce = istate->cache[pos++];
 
 		if (strncmp(ce->name, path, len))
 			break;
@@ -378,7 +378,7 @@ static int process_path(const char *path, struct stat *st, int stat_errno)
 		return error("'%s' is beyond a symbolic link", path);
 
 	pos = cache_name_pos(path, len);
-	ce = pos < 0 ? NULL : active_cache[pos];
+	ce = pos < 0 ? NULL : istate->cache[pos];
 	if (ce && ce_skip_worktree(ce)) {
 		/*
 		 * working directory version is assumed "good"
@@ -440,7 +440,7 @@ static void chmod_path(char flip, const char *path)
 	pos = cache_name_pos(path, strlen(path));
 	if (pos < 0)
 		goto fail;
-	ce = active_cache[pos];
+	ce = istate->cache[pos];
 	if (chmod_cache_entry(ce, flip) < 0)
 		goto fail;
 
@@ -639,7 +639,7 @@ static int unresolve_one(const char *path)
 		/* already merged */
 		pos = unmerge_cache_entry_at(pos);
 		if (pos < active_nr) {
-			const struct cache_entry *ce = active_cache[pos];
+			const struct cache_entry *ce = istate->cache[pos];
 			if (ce_stage(ce) &&
 			    ce_namelen(ce) == namelen &&
 			    !memcmp(ce->name, path, namelen))
@@ -653,7 +653,7 @@ static int unresolve_one(const char *path)
 		 */
 		pos = -pos-1;
 		if (pos < active_nr) {
-			const struct cache_entry *ce = active_cache[pos];
+			const struct cache_entry *ce = istate->cache[pos];
 			if (ce_namelen(ce) == namelen &&
 			    !memcmp(ce->name, path, namelen)) {
 				fprintf(stderr,
@@ -749,7 +749,7 @@ static int do_reupdate(int ac, const char **av,
 		has_head = 0;
  redo:
 	for (pos = 0; pos < active_nr; pos++) {
-		const struct cache_entry *ce = active_cache[pos];
+		const struct cache_entry *ce = istate->cache[pos];
 		struct cache_entry *old = NULL;
 		int save_nr;
 		char *path;
-- 
gitgitgadget
Previous: Derrick Stolee via GitGitGadgetNext: Derrick Stolee via GitGitGadget
Message 16 of 65 in “Remove more index compatibility macros”
  1. 00/12 Remove more index compatibility macrosDerrick Stolee via GitGitGadget, Jan 1, 2021
  2. 01/12 merge-index: drop index compatibility macrosDerrick Stolee via GitGitGadget, Jan 1, 2021
  3. Alban GruinJan 3, 2021
  4. Derrick StoleeJan 4, 2021
  5. 02/12 mv: remove index compatibility macrosDerrick Stolee via GitGitGadget, Jan 1, 2021
  6. 03/12 rm: remove compatilibity macrosDerrick Stolee via GitGitGadget, Jan 1, 2021
  7. 04/12 update-index: drop the_index, the_repositoryDerrick Stolee via GitGitGadget, Jan 1, 2021
  8. Elijah NewrenJan 1, 2021
  9. Derrick StoleeJan 4, 2021
  10. 07/12 update-index: use istate->cache_changedDerrick Stolee via GitGitGadget, Jan 1, 2021
  11. 06/12 update-index: use index->cache_nr over active_nrDerrick Stolee via GitGitGadget, Jan 1, 2021
  12. 10/12 update-index: use add_index_entry()Derrick Stolee via GitGitGadget, Jan 1, 2021
  13. 11/12 update-index: replace several compatibility macrosDerrick Stolee via GitGitGadget, Jan 1, 2021
  14. 09/12 update-index: use remove_file_from_index()Derrick Stolee via GitGitGadget, Jan 1, 2021
  15. 08/12 update-index: use index_name_pos() over cache_name_pos()Derrick Stolee via GitGitGadget, Jan 1, 2021
  16. 05/12 update-index: use istate->cache over active_cacheDerrick Stolee via GitGitGadget, Jan 1, 2021
  17. 12/12 update-index: remove ce_match_stat(), all macrosDerrick Stolee via GitGitGadget, Jan 1, 2021
  18. Elijah NewrenJan 1, 2021
  19. Elijah NewrenJan 1, 2021
  20. Eric SunshineJan 2, 2021
  21. Derrick StoleeJan 4, 2021
  22. Eric SunshineJan 4, 2021
  23. Derrick StoleeJan 5, 2021
  24. 00/14 Remove more index compatibility macrosDerrick Stolee via GitGitGadget, Jan 5, 2021
  25. 03/14 update-index: drop the_index, the_repositoryDerrick Stolee via GitGitGadget, Jan 5, 2021
  26. 02/14 rm: remove compatilibity macrosDerrick Stolee via GitGitGadget, Jan 5, 2021
  27. 01/14 mv: remove index compatibility macrosDerrick Stolee via GitGitGadget, Jan 5, 2021
  28. 04/14 update-index: use istate->cache over active_cacheDerrick Stolee via GitGitGadget, Jan 5, 2021
  29. 05/14 update-index: use index->cache_nr over active_nrDerrick Stolee via GitGitGadget, Jan 5, 2021
  30. 07/14 update-index: use index_name_pos() over cache_name_pos()Derrick Stolee via GitGitGadget, Jan 5, 2021
  31. 09/14 update-index: use add_index_entry()Derrick Stolee via GitGitGadget, Jan 5, 2021
  32. 12/14 update-index: reduce static globals, part 1Derrick Stolee via GitGitGadget, Jan 5, 2021
  33. 14/14 update-index: remove static globals from callbacksDerrick Stolee via GitGitGadget, Jan 5, 2021
  34. Eric SunshineJan 7, 2021
  35. Derrick StoleeJan 7, 2021
  36. Eric SunshineJan 7, 2021
  37. Junio C HamanoJan 7, 2021
  38. Derrick StoleeJan 8, 2021
  39. 10/14 update-index: replace several compatibility macrosDerrick Stolee via GitGitGadget, Jan 5, 2021
  40. 08/14 update-index: use remove_file_from_index()Derrick Stolee via GitGitGadget, Jan 5, 2021
  41. 06/14 update-index: use istate->cache_changedDerrick Stolee via GitGitGadget, Jan 5, 2021
  42. 13/14 update-index: reduce static globals, part 2Derrick Stolee via GitGitGadget, Jan 5, 2021
  43. 11/14 update-index: remove ce_match_stat(), all macrosDerrick Stolee via GitGitGadget, Jan 5, 2021
  44. 00/14 Remove more index compatibility macrosDerrick Stolee via GitGitGadget, Jan 8, 2021
  45. 01/14 mv: remove index compatibility macrosDerrick Stolee via GitGitGadget, Jan 8, 2021
  46. 02/14 rm: remove compatilibity macrosDerrick Stolee via GitGitGadget, Jan 8, 2021
  47. 04/14 update-index: use istate->cache over active_cacheDerrick Stolee via GitGitGadget, Jan 8, 2021
  48. 03/14 update-index: drop the_index, the_repositoryDerrick Stolee via GitGitGadget, Jan 8, 2021
  49. 12/14 update-index: reduce static globals, part 1Derrick Stolee via GitGitGadget, Jan 8, 2021
  50. 05/14 update-index: use istate->cache_nr over active_nrDerrick Stolee via GitGitGadget, Jan 8, 2021
  51. 07/14 update-index: use index_name_pos() over cache_name_pos()Derrick Stolee via GitGitGadget, Jan 8, 2021
  52. 09/14 update-index: use add_index_entry()Derrick Stolee via GitGitGadget, Jan 8, 2021
  53. 11/14 update-index: remove ce_match_stat(), all macrosDerrick Stolee via GitGitGadget, Jan 8, 2021
  54. 06/14 update-index: use istate->cache_changedDerrick Stolee via GitGitGadget, Jan 8, 2021
  55. 10/14 update-index: replace several compatibility macrosDerrick Stolee via GitGitGadget, Jan 8, 2021
  56. 08/14 update-index: use remove_file_from_index()Derrick Stolee via GitGitGadget, Jan 8, 2021
  57. 13/14 update-index: reduce static globals, part 2Derrick Stolee via GitGitGadget, Jan 8, 2021
  58. 14/14 update-index: remove static globals from callbacksDerrick Stolee via GitGitGadget, Jan 8, 2021
  59. Junio C HamanoJan 10, 2021
  60. Eric SunshineJan 10, 2021
  61. Derrick StoleeJan 10, 2021
  62. Derrick StoleeJan 25, 2021
  63. Junio C HamanoJan 6, 2021
  64. Derrick StoleeJan 6, 2021
  65. Junio C HamanoJan 6, 2021

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.