diff mbox series

[v2,05/14] update-index: use index->cache_nr over active_nr

Message ID 6c0e019f91ce50bef8a98ac60072a61c77710080.1609821783.git.gitgitgadget@gmail.com (mailing list archive)
State Superseded
Headers show
Series Remove more index compatibility macros | expand

Commit Message

Derrick Stolee Jan. 5, 2021, 4:42 a.m. UTC
From: Derrick Stolee <dstolee@microsoft.com>

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
---
 builtin/update-index.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/builtin/update-index.c b/builtin/update-index.c
index 3e459d2b9de..106bfdab78e 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -346,7 +346,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) {
+	while (pos < istate->cache_nr) {
 		const struct cache_entry *ce = istate->cache[pos++];
 
 		if (strncmp(ce->name, path, len))
@@ -627,7 +627,7 @@  static int unresolve_one(const char *path)
 	if (0 <= pos) {
 		/* already merged */
 		pos = unmerge_cache_entry_at(pos);
-		if (pos < active_nr) {
+		if (pos < istate->cache_nr) {
 			const struct cache_entry *ce = istate->cache[pos];
 			if (ce_stage(ce) &&
 			    ce_namelen(ce) == namelen &&
@@ -641,7 +641,7 @@  static int unresolve_one(const char *path)
 		 * want to do anything in the former case.
 		 */
 		pos = -pos-1;
-		if (pos < active_nr) {
+		if (pos < istate->cache_nr) {
 			const struct cache_entry *ce = istate->cache[pos];
 			if (ce_namelen(ce) == namelen &&
 			    !memcmp(ce->name, path, namelen)) {
@@ -737,7 +737,7 @@  static int do_reupdate(int ac, const char **av,
 		 */
 		has_head = 0;
  redo:
-	for (pos = 0; pos < active_nr; pos++) {
+	for (pos = 0; pos < istate->cache_nr; pos++) {
 		const struct cache_entry *ce = istate->cache[pos];
 		struct cache_entry *old = NULL;
 		int save_nr;
@@ -755,14 +755,14 @@  static int do_reupdate(int ac, const char **av,
 		}
 		/* Be careful.  The working tree may not have the
 		 * path anymore, in which case, under 'allow_remove',
-		 * or worse yet 'allow_replace', active_nr may decrease.
+		 * or worse yet 'allow_replace', istate->cache_nr may decrease.
 		 */
-		save_nr = active_nr;
+		save_nr = istate->cache_nr;
 		path = xstrdup(ce->name);
 		update_one(path);
 		free(path);
 		discard_cache_entry(old);
-		if (save_nr != active_nr)
+		if (save_nr != istate->cache_nr)
 			goto redo;
 	}
 	clear_pathspec(&pathspec);