builtin: stop using the_index
Convert builtins to use `the_repository->index` instead of `the_index`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
319ba14407
commit
f59aa5e0a9
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2005 Linus Torvalds
|
||||
*
|
||||
*/
|
||||
#define USE_THE_INDEX_VARIABLE
|
||||
|
||||
#include "builtin.h"
|
||||
#include "config.h"
|
||||
#include "gettext.h"
|
||||
@@ -69,7 +69,7 @@ static void write_tempfile_record(const char *name, const char *prefix)
|
||||
static int checkout_file(const char *name, const char *prefix)
|
||||
{
|
||||
int namelen = strlen(name);
|
||||
int pos = index_name_pos(&the_index, name, namelen);
|
||||
int pos = index_name_pos(the_repository->index, name, namelen);
|
||||
int has_same_name = 0;
|
||||
int is_file = 0;
|
||||
int is_skipped = 1;
|
||||
@@ -79,8 +79,8 @@ static int checkout_file(const char *name, const char *prefix)
|
||||
if (pos < 0)
|
||||
pos = -pos - 1;
|
||||
|
||||
while (pos < the_index.cache_nr) {
|
||||
struct cache_entry *ce = the_index.cache[pos];
|
||||
while (pos <the_repository->index->cache_nr) {
|
||||
struct cache_entry *ce =the_repository->index->cache[pos];
|
||||
if (ce_namelen(ce) != namelen ||
|
||||
memcmp(ce->name, name, namelen))
|
||||
break;
|
||||
@@ -140,8 +140,8 @@ static int checkout_all(const char *prefix, int prefix_length)
|
||||
int i, errs = 0;
|
||||
struct cache_entry *last_ce = NULL;
|
||||
|
||||
for (i = 0; i < the_index.cache_nr ; i++) {
|
||||
struct cache_entry *ce = the_index.cache[i];
|
||||
for (i = 0; i < the_repository->index->cache_nr ; i++) {
|
||||
struct cache_entry *ce = the_repository->index->cache[i];
|
||||
|
||||
if (S_ISSPARSEDIR(ce->ce_mode)) {
|
||||
if (!ce_skip_worktree(ce))
|
||||
@@ -154,8 +154,8 @@ static int checkout_all(const char *prefix, int prefix_length)
|
||||
* first entry inside the expanded sparse directory).
|
||||
*/
|
||||
if (ignore_skip_worktree) {
|
||||
ensure_full_index(&the_index);
|
||||
ce = the_index.cache[i];
|
||||
ensure_full_index(the_repository->index);
|
||||
ce = the_repository->index->cache[i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
|
||||
|
||||
argc = parse_options(argc, argv, prefix, builtin_checkout_index_options,
|
||||
builtin_checkout_index_usage, 0);
|
||||
state.istate = &the_index;
|
||||
state.istate = the_repository->index;
|
||||
state.force = force;
|
||||
state.quiet = quiet;
|
||||
state.not_new = not_new;
|
||||
@@ -280,7 +280,7 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
|
||||
*/
|
||||
if (index_opt && !state.base_dir_len && !to_tempfile) {
|
||||
state.refresh_cache = 1;
|
||||
state.istate = &the_index;
|
||||
state.istate = the_repository->index;
|
||||
repo_hold_locked_index(the_repository, &lock_file,
|
||||
LOCK_DIE_ON_ERROR);
|
||||
}
|
||||
@@ -339,7 +339,7 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
|
||||
return 1;
|
||||
|
||||
if (is_lock_file_locked(&lock_file) &&
|
||||
write_locked_index(&the_index, &lock_file, COMMIT_LOCK))
|
||||
write_locked_index(the_repository->index, &lock_file, COMMIT_LOCK))
|
||||
die("Unable to write new index file");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user