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>
This commit is contained in:
parent
383480ba4f
commit
86016ec304
@ -1238,7 +1238,7 @@ static int clear_ce_flags(struct cache_entry **cache, int nr,
|
|||||||
* Set/Clear CE_NEW_SKIP_WORKTREE according to $GIT_DIR/info/sparse-checkout
|
* Set/Clear CE_NEW_SKIP_WORKTREE according to $GIT_DIR/info/sparse-checkout
|
||||||
*/
|
*/
|
||||||
static void mark_new_skip_worktree(struct exclude_list *el,
|
static void mark_new_skip_worktree(struct exclude_list *el,
|
||||||
struct index_state *the_index,
|
struct index_state *istate,
|
||||||
int select_flag, int skip_wt_flag)
|
int select_flag, int skip_wt_flag)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -1247,8 +1247,8 @@ static void mark_new_skip_worktree(struct exclude_list *el,
|
|||||||
* 1. Pretend the narrowest worktree: only unmerged entries
|
* 1. Pretend the narrowest worktree: only unmerged entries
|
||||||
* are checked out
|
* are checked out
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < the_index->cache_nr; i++) {
|
for (i = 0; i < istate->cache_nr; i++) {
|
||||||
struct cache_entry *ce = the_index->cache[i];
|
struct cache_entry *ce = istate->cache[i];
|
||||||
|
|
||||||
if (select_flag && !(ce->ce_flags & select_flag))
|
if (select_flag && !(ce->ce_flags & select_flag))
|
||||||
continue;
|
continue;
|
||||||
@ -1263,8 +1263,7 @@ static void mark_new_skip_worktree(struct exclude_list *el,
|
|||||||
* 2. Widen worktree according to sparse-checkout file.
|
* 2. Widen worktree according to sparse-checkout file.
|
||||||
* Matched entries will have skip_wt_flag cleared (i.e. "in")
|
* Matched entries will have skip_wt_flag cleared (i.e. "in")
|
||||||
*/
|
*/
|
||||||
clear_ce_flags(the_index->cache, the_index->cache_nr,
|
clear_ce_flags(istate->cache, istate->cache_nr, select_flag, skip_wt_flag, el);
|
||||||
select_flag, skip_wt_flag, el);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int verify_absent(const struct cache_entry *,
|
static int verify_absent(const struct cache_entry *,
|
||||||
|
Loading…
Reference in New Issue
Block a user