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

[PATCH 14/15] wt-status.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-15-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>
---
 wt-status.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/wt-status.c b/wt-status.c
index d1c05145a4..9859a43ec8 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -499,14 +499,14 @@ static int unmerged_mask(const char *path)
 	int pos, mask;
 	const struct cache_entry *ce;
 
-	pos = cache_name_pos(path, strlen(path));
+	pos = index_name_pos(&the_index, path, strlen(path));
 	if (0 <= pos)
 		return 0;
 
 	mask = 0;
 	pos = -pos-1;
-	while (pos < active_nr) {
-		ce = active_cache[pos++];
+	while (pos < the_index.cache_nr) {
+		ce = the_index.cache[pos++];
 		if (strcmp(ce->name, path) || !ce_stage(ce))
 			break;
 		mask |= (1 << (ce_stage(ce) - 1));
@@ -642,10 +642,10 @@ static void wt_status_collect_changes_initial(struct wt_status *s)
 {
 	int i;
 
-	for (i = 0; i < active_nr; i++) {
+	for (i = 0; i < the_index.cache_nr; i++) {
 		struct string_list_item *it;
 		struct wt_status_change_data *d;
-		const struct cache_entry *ce = active_cache[i];
+		const struct cache_entry *ce = the_index.cache[i];
 
 		if (!ce_path_match(ce, &s->pathspec, NULL))
 			continue;
@@ -702,7 +702,7 @@ static void wt_status_collect_untracked(struct wt_status *s)
 
 	for (i = 0; i < dir.nr; i++) {
 		struct dir_entry *ent = dir.entries[i];
-		if (cache_name_is_other(ent->name, ent->len) &&
+		if (index_name_is_other(&the_index, ent->name, ent->len) &&
 		    dir_path_match(ent, &s->pathspec, 0, NULL))
 			string_list_insert(&s->untracked, ent->name);
 		free(ent);
@@ -710,7 +710,7 @@ static void wt_status_collect_untracked(struct wt_status *s)
 
 	for (i = 0; i < dir.ignored_nr; i++) {
 		struct dir_entry *ent = dir.ignored[i];
-		if (cache_name_is_other(ent->name, ent->len) &&
+		if (index_name_is_other(&the_index, ent->name, ent->len) &&
 		    dir_path_match(ent, &s->pathspec, 0, NULL))
 			string_list_insert(&s->ignored, ent->name);
 		free(ent);
@@ -2180,11 +2180,11 @@ static void wt_porcelain_v2_print_unmerged_entry(
 	 */
 	memset(stages, 0, sizeof(stages));
 	sum = 0;
-	pos = cache_name_pos(it->string, strlen(it->string));
+	pos = index_name_pos(&the_index, it->string, strlen(it->string));
 	assert(pos < 0);
 	pos = -pos-1;
-	while (pos < active_nr) {
-		ce = active_cache[pos++];
+	while (pos < the_index.cache_nr) {
+		ce = the_index.cache[pos++];
 		stage = ce_stage(ce);
 		if (strcmp(ce->name, it->string) || !stage)
 			break;
@@ -2333,7 +2333,7 @@ int has_uncommitted_changes(int ignore_submodules)
 	struct rev_info rev_info;
 	int result;
 
-	if (is_cache_unborn())
+	if (is_index_unborn(&the_index))
 		return 0;
 
 	init_revisions(&rev_info, NULL);
@@ -2356,7 +2356,7 @@ int require_clean_work_tree(const char *action, const char *hint, int ignore_sub
 	int err = 0, fd;
 
 	fd = hold_locked_index(&lock_file, 0);
-	refresh_cache(REFRESH_QUIET);
+	refresh_index(&the_index, REFRESH_QUIET, NULL, NULL, NULL);
 	if (0 <= fd)
 		update_index_if_able(&the_index, &lock_file);
 	rollback_lock_file(&lock_file);
-- 
2.18.0.rc0.333.g22e6ee6cdf
Previous: Nguyễn Thái Ngọc DuyNext: Nguyễn Thái Ngọc Duy
Message 11 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.