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
@ -1,4 +1,3 @@
|
||||
#define USE_THE_INDEX_VARIABLE
|
||||
#include "builtin.h"
|
||||
#include "hex.h"
|
||||
#include "read-cache-ll.h"
|
||||
@ -18,11 +17,11 @@ static int merge_entry(int pos, const char *path)
|
||||
char ownbuf[4][60];
|
||||
struct child_process cmd = CHILD_PROCESS_INIT;
|
||||
|
||||
if (pos >= the_index.cache_nr)
|
||||
if (pos >= the_repository->index->cache_nr)
|
||||
die("git merge-index: %s not in the cache", path);
|
||||
found = 0;
|
||||
do {
|
||||
const struct cache_entry *ce = the_index.cache[pos];
|
||||
const struct cache_entry *ce = the_repository->index->cache[pos];
|
||||
int stage = ce_stage(ce);
|
||||
|
||||
if (strcmp(ce->name, path))
|
||||
@ -32,7 +31,7 @@ static int merge_entry(int pos, const char *path)
|
||||
xsnprintf(ownbuf[stage], sizeof(ownbuf[stage]), "%o", ce->ce_mode);
|
||||
arguments[stage] = hexbuf[stage];
|
||||
arguments[stage + 4] = ownbuf[stage];
|
||||
} while (++pos < the_index.cache_nr);
|
||||
} while (++pos < the_repository->index->cache_nr);
|
||||
if (!found)
|
||||
die("git merge-index: %s not in the cache", path);
|
||||
|
||||
@ -51,7 +50,7 @@ static int merge_entry(int pos, const char *path)
|
||||
|
||||
static void merge_one_path(const char *path)
|
||||
{
|
||||
int pos = index_name_pos(&the_index, path, strlen(path));
|
||||
int pos = index_name_pos(the_repository->index, path, strlen(path));
|
||||
|
||||
/*
|
||||
* If it already exists in the cache as stage0, it's
|
||||
@ -65,9 +64,9 @@ static void merge_all(void)
|
||||
{
|
||||
int i;
|
||||
/* TODO: audit for interaction with sparse-index. */
|
||||
ensure_full_index(&the_index);
|
||||
for (i = 0; i < the_index.cache_nr; i++) {
|
||||
const struct cache_entry *ce = the_index.cache[i];
|
||||
ensure_full_index(the_repository->index);
|
||||
for (i = 0; i < the_repository->index->cache_nr; i++) {
|
||||
const struct cache_entry *ce = the_repository->index->cache[i];
|
||||
if (!ce_stage(ce))
|
||||
continue;
|
||||
i += merge_entry(i, ce->name)-1;
|
||||
@ -89,7 +88,7 @@ int cmd_merge_index(int argc, const char **argv, const char *prefix UNUSED)
|
||||
repo_read_index(the_repository);
|
||||
|
||||
/* TODO: audit for interaction with sparse-index. */
|
||||
ensure_full_index(&the_index);
|
||||
ensure_full_index(the_repository->index);
|
||||
|
||||
i = 1;
|
||||
if (!strcmp(argv[i], "-o")) {
|
||||
|
Reference in New Issue
Block a user