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,6 @@
|
||||
* Copyright (C) Linus Torvalds, 2005
|
||||
*/
|
||||
|
||||
#define USE_THE_INDEX_VARIABLE
|
||||
#include "builtin.h"
|
||||
#include "config.h"
|
||||
#include "gettext.h"
|
||||
@ -159,8 +158,8 @@ int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix)
|
||||
|
||||
memset(&opts, 0, sizeof(opts));
|
||||
opts.head_idx = -1;
|
||||
opts.src_index = &the_index;
|
||||
opts.dst_index = &the_index;
|
||||
opts.src_index = the_repository->index;
|
||||
opts.dst_index = the_repository->index;
|
||||
|
||||
git_config(git_read_tree_config, NULL);
|
||||
|
||||
@ -197,7 +196,7 @@ int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix)
|
||||
die(_("You need to resolve your current index first"));
|
||||
stage = opts.merge = 1;
|
||||
}
|
||||
resolve_undo_clear_index(&the_index);
|
||||
resolve_undo_clear_index(the_repository->index);
|
||||
|
||||
for (i = 0; i < argc; i++) {
|
||||
const char *arg = argv[i];
|
||||
@ -225,7 +224,7 @@ int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix)
|
||||
setup_work_tree();
|
||||
|
||||
if (opts.skip_sparse_checkout)
|
||||
ensure_full_index(&the_index);
|
||||
ensure_full_index(the_repository->index);
|
||||
|
||||
if (opts.merge) {
|
||||
switch (stage - 1) {
|
||||
@ -237,7 +236,7 @@ int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix)
|
||||
break;
|
||||
case 2:
|
||||
opts.fn = twoway_merge;
|
||||
opts.initial_checkout = is_index_unborn(&the_index);
|
||||
opts.initial_checkout = is_index_unborn(the_repository->index);
|
||||
break;
|
||||
case 3:
|
||||
default:
|
||||
@ -258,7 +257,7 @@ int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix)
|
||||
if (nr_trees == 1 && !opts.prefix)
|
||||
opts.skip_cache_tree_update = 1;
|
||||
|
||||
cache_tree_free(&the_index.cache_tree);
|
||||
cache_tree_free(&the_repository->index->cache_tree);
|
||||
for (i = 0; i < nr_trees; i++) {
|
||||
struct tree *tree = trees[i];
|
||||
if (parse_tree(tree) < 0)
|
||||
@ -282,7 +281,7 @@ int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix)
|
||||
the_repository->index,
|
||||
trees[0]);
|
||||
|
||||
if (write_locked_index(&the_index, &lock_file, COMMIT_LOCK))
|
||||
if (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