unpack-trees: don't shadow global var the_index
This function mark_new_skip_worktree() has an argument named the_index which is also the name of a global variable. While they have different types (the global the_index is not a pointer) mistakes can easily happen and it's also confusing for readers. Rename the function argument to something other than the_index. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Aug 13, 2018 at 18:14 UTC
86016ec3042ec52eef9f45386c50384419d030c0
1 file changed
+4
-5
unpack-trees.c
+4
-5
@@ -1238,7 +1238,7 @@ static int clear_ce_flags(struct cache_entry **cache, int nr,
1238
* Set/Clear CE_NEW_SKIP_WORKTREE according to $GIT_DIR/info/sparse-checkout
1239
*/
1240
static void mark_new_skip_worktree(struct exclude_list *el,
1241
- struct index_state *the_index,
1241
+ struct index_state *istate,
1242
int select_flag, int skip_wt_flag)
1243
{
1244
int i;
@@ -1247,8 +1247,8 @@ static void mark_new_skip_worktree(struct exclude_list *el,
1247
* 1. Pretend the narrowest worktree: only unmerged entries
1248
* are checked out
1249
*/
1250
- for (i = 0; i < the_index->cache_nr; i++) {
1251
- struct cache_entry *ce = the_index->cache[i];
1250
+ for (i = 0; i < istate->cache_nr; i++) {
1251
+ struct cache_entry *ce = istate->cache[i];
1252
1253
if (select_flag && !(ce->ce_flags & select_flag))
1254
continue;
@@ -1263,8 +1263,7 @@ static void mark_new_skip_worktree(struct exclude_list *el,
1263
* 2. Widen worktree according to sparse-checkout file.
1264
* Matched entries will have skip_wt_flag cleared (i.e. "in")
1265
*/
1266
- clear_ce_flags(the_index->cache, the_index->cache_nr,
1267
- select_flag, skip_wt_flag, el);
1266
+ clear_ce_flags(istate->cache, istate->cache_nr, select_flag, skip_wt_flag, el);
1267
}
1268
1269
static int verify_absent(const struct cache_entry *,