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

[PATCH 11/15] revision.c: stop using index compat macros

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Jun 16, 2018, 05:41 UTC
Message-ID
<20180616054157.32433-12-pclouds@gmail.com>
In-Reply-To
<20180616054157.32433-1-pclouds@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 revision.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/revision.c b/revision.c
index 40fd91ff2b..d56ca57717 100644
--- a/revision.c
+++ b/revision.c
@@ -1354,7 +1354,7 @@ void add_index_objects_to_pending(struct rev_info *revs, unsigned int flags)
 {
 	struct worktree **worktrees, **p;
 
-	read_cache();
+	read_index(&the_index);
 	do_add_index_objects_to_pending(revs, &the_index);
 
 	if (revs->single_worktree)
@@ -1495,10 +1495,10 @@ static void prepare_show_merge(struct rev_info *revs)
 	free_commit_list(bases);
 	head->object.flags |= SYMMETRIC_LEFT;
 
-	if (!active_nr)
-		read_cache();
-	for (i = 0; i < active_nr; i++) {
-		const struct cache_entry *ce = active_cache[i];
+	if (!the_index.cache_nr)
+		read_index(&the_index);
+	for (i = 0; i < the_index.cache_nr; i++) {
+		const struct cache_entry *ce = the_index.cache[i];
 		if (!ce_stage(ce))
 			continue;
 		if (ce_path_match(ce, &revs->prune_data, NULL)) {
@@ -1507,8 +1507,8 @@ static void prepare_show_merge(struct rev_info *revs)
 			prune[prune_num-2] = ce->name;
 			prune[prune_num-1] = NULL;
 		}
-		while ((i+1 < active_nr) &&
-		       ce_same_name(ce, active_cache[i+1]))
+		while ((i+1 < the_index.cache_nr) &&
+		       ce_same_name(ce, the_index.cache[i+1]))
 			i++;
 	}
 	clear_pathspec(&revs->prune_data);
-- 
2.18.0.rc0.333.g22e6ee6cdf
Previous: Nguyễn Thái Ngọc DuyNext: Nguyễn Thái Ngọc Duy
Message 9 of 32 in “Kill the_index part 1, expose it”
  1. 00/15 Kill the_index part 1, expose itNguyễn Thái Ngọc Duy, Jun 16, 2018
  2. 01/15 contrib: add cocci script to replace index compat macrosNguyễn Thái Ngọc Duy, Jun 16, 2018
  3. Derrick StoleeJun 19, 2018
  4. Derrick StoleeJun 19, 2018
  5. Duy NguyenJun 19, 2018
  6. Derrick StoleeJun 19, 2018
  7. SZEDER GáborJul 23, 2018
  8. 05/15 diff-lib.c: stop using index compat macrosNguyễn Thái Ngọc Duy, Jun 16, 2018
  9. 11/15 revision.c: stop using index compat macrosNguyễn Thái Ngọc Duy, Jun 16, 2018
  10. 04/15 check-racy.c: stop using index compat macrosNguyễn Thái Ngọc Duy, Jun 16, 2018
  11. 14/15 wt-status.c: stop using index compat macrosNguyễn Thái Ngọc Duy, Jun 16, 2018
  12. 10/15 rerere.c: stop using index compat macrosNguyễn Thái Ngọc Duy, Jun 16, 2018
  13. 12/15 sequencer.c: stop using index compat macrosNguyễn Thái Ngọc Duy, Jun 16, 2018
  14. 13/15 sha1-name.c: stop using index compat macrosNguyễn Thái Ngọc Duy, Jun 16, 2018
  15. 03/15 blame.c: stop using index compat macrosNguyễn Thái Ngọc Duy, Jun 16, 2018
  16. 08/15 merge-recursive.c: stop using index compat macrosNguyễn Thái Ngọc Duy, Jun 16, 2018
  17. 09/15 merge.c: stop using index compat macrosNguyễn Thái Ngọc Duy, Jun 16, 2018
  18. 15/15 cache.h: flip NO_THE_INDEX_COMPATIBILITY_MACROS switchNguyễn Thái Ngọc Duy, Jun 16, 2018
  19. Brandon WilliamsJun 18, 2018
  20. 02/15 apply.c: stop using index compat macrosNguyễn Thái Ngọc Duy, Jun 16, 2018
  21. Junio C HamanoJun 25, 2018
  22. Duy NguyenJun 30, 2018
  23. Junio C HamanoJul 3, 2018
  24. Duy NguyenJul 9, 2018
  25. 07/15 entry.c: stop using index compat macrosNguyễn Thái Ngọc Duy, Jun 16, 2018
  26. 06/15 diff.c: stop using index compat macrosNguyễn Thái Ngọc Duy, Jun 16, 2018
  27. Elijah NewrenJun 17, 2018
  28. Duy NguyenJun 17, 2018
  29. Brandon WilliamsJun 18, 2018
  30. Ben PeartJun 19, 2018
  31. Derrick StoleeJun 19, 2018
  32. Duy NguyenJun 19, 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.