cocci: apply "pending" index-compatibility to "t/helper/*.c"
Apply the "index-compatibility.pending.cocci" rule to the "t/helper/*" directory, a subsequent commit will extend cache.h to further narrow down the use of "USE_THE_INDEX_COMPATIBILITY_MACROS" in this area. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
dc594180d9
commit
0ea414a14d
@ -30,7 +30,7 @@ int cmd__cache_tree(int argc, const char **argv)
|
|||||||
|
|
||||||
argc = parse_options(argc, argv, NULL, options, test_cache_tree_usage, 0);
|
argc = parse_options(argc, argv, NULL, options, test_cache_tree_usage, 0);
|
||||||
|
|
||||||
if (read_cache() < 0)
|
if (repo_read_index(the_repository) < 0)
|
||||||
die(_("unable to read index file"));
|
die(_("unable to read index file"));
|
||||||
|
|
||||||
oidcpy(&oid, &the_index.cache_tree->oid);
|
oidcpy(&oid, &the_index.cache_tree->oid);
|
||||||
|
@ -62,7 +62,7 @@ int cmd__dump_cache_tree(int ac, const char **av)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
setup_git_directory();
|
setup_git_directory();
|
||||||
if (read_cache() < 0)
|
if (repo_read_index(the_repository) < 0)
|
||||||
die("unable to read index file");
|
die("unable to read index file");
|
||||||
istate = the_index;
|
istate = the_index;
|
||||||
istate.cache_tree = another;
|
istate.cache_tree = another;
|
||||||
|
@ -51,7 +51,7 @@ int cmd__dump_untracked_cache(int ac, const char **av)
|
|||||||
xsetenv("GIT_CONFIG_VALUE_0", "keep", 1);
|
xsetenv("GIT_CONFIG_VALUE_0", "keep", 1);
|
||||||
|
|
||||||
setup_git_directory();
|
setup_git_directory();
|
||||||
if (read_cache() < 0)
|
if (repo_read_index(the_repository) < 0)
|
||||||
die("unable to read index file");
|
die("unable to read index file");
|
||||||
uc = the_index.untracked;
|
uc = the_index.untracked;
|
||||||
if (!uc) {
|
if (!uc) {
|
||||||
|
@ -123,7 +123,7 @@ int cmd__fast_rebase(int argc, const char **argv)
|
|||||||
die(_("Cannot read HEAD"));
|
die(_("Cannot read HEAD"));
|
||||||
assert(oideq(&onto->object.oid, &head));
|
assert(oideq(&onto->object.oid, &head));
|
||||||
|
|
||||||
hold_locked_index(&lock, LOCK_DIE_ON_ERROR);
|
repo_hold_locked_index(the_repository, &lock, LOCK_DIE_ON_ERROR);
|
||||||
if (repo_read_index(the_repository) < 0)
|
if (repo_read_index(the_repository) < 0)
|
||||||
BUG("Could not read index");
|
BUG("Could not read index");
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ static void dump_run(void)
|
|||||||
struct dir_entry *dir;
|
struct dir_entry *dir;
|
||||||
struct cache_entry *ce;
|
struct cache_entry *ce;
|
||||||
|
|
||||||
read_cache();
|
repo_read_index(the_repository);
|
||||||
if (single) {
|
if (single) {
|
||||||
test_lazy_init_name_hash(&the_index, 0);
|
test_lazy_init_name_hash(&the_index, 0);
|
||||||
} else {
|
} else {
|
||||||
@ -49,7 +49,7 @@ static void dump_run(void)
|
|||||||
ent /* member name */)
|
ent /* member name */)
|
||||||
printf("name %08x %s\n", ce->ent.hash, ce->name);
|
printf("name %08x %s\n", ce->ent.hash, ce->name);
|
||||||
|
|
||||||
discard_cache();
|
discard_index(&the_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -66,7 +66,7 @@ static uint64_t time_runs(int try_threaded)
|
|||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
t0 = getnanotime();
|
t0 = getnanotime();
|
||||||
read_cache();
|
repo_read_index(the_repository);
|
||||||
t1 = getnanotime();
|
t1 = getnanotime();
|
||||||
nr_threads_used = test_lazy_init_name_hash(&the_index, try_threaded);
|
nr_threads_used = test_lazy_init_name_hash(&the_index, try_threaded);
|
||||||
t2 = getnanotime();
|
t2 = getnanotime();
|
||||||
@ -89,7 +89,7 @@ static uint64_t time_runs(int try_threaded)
|
|||||||
the_index.cache_nr);
|
the_index.cache_nr);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
discard_cache();
|
discard_index(&the_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
avg = sum / count;
|
avg = sum / count;
|
||||||
@ -113,9 +113,9 @@ static void analyze_run(void)
|
|||||||
int i;
|
int i;
|
||||||
int nr;
|
int nr;
|
||||||
|
|
||||||
read_cache();
|
repo_read_index(the_repository);
|
||||||
cache_nr_limit = the_index.cache_nr;
|
cache_nr_limit = the_index.cache_nr;
|
||||||
discard_cache();
|
discard_index(&the_index);
|
||||||
|
|
||||||
nr = analyze;
|
nr = analyze;
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -128,23 +128,23 @@ static void analyze_run(void)
|
|||||||
nr = cache_nr_limit;
|
nr = cache_nr_limit;
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
read_cache();
|
repo_read_index(the_repository);
|
||||||
the_index.cache_nr = nr; /* cheap truncate of index */
|
the_index.cache_nr = nr; /* cheap truncate of index */
|
||||||
t1s = getnanotime();
|
t1s = getnanotime();
|
||||||
test_lazy_init_name_hash(&the_index, 0);
|
test_lazy_init_name_hash(&the_index, 0);
|
||||||
t2s = getnanotime();
|
t2s = getnanotime();
|
||||||
sum_single += (t2s - t1s);
|
sum_single += (t2s - t1s);
|
||||||
the_index.cache_nr = cache_nr_limit;
|
the_index.cache_nr = cache_nr_limit;
|
||||||
discard_cache();
|
discard_index(&the_index);
|
||||||
|
|
||||||
read_cache();
|
repo_read_index(the_repository);
|
||||||
the_index.cache_nr = nr; /* cheap truncate of index */
|
the_index.cache_nr = nr; /* cheap truncate of index */
|
||||||
t1m = getnanotime();
|
t1m = getnanotime();
|
||||||
nr_threads_used = test_lazy_init_name_hash(&the_index, 1);
|
nr_threads_used = test_lazy_init_name_hash(&the_index, 1);
|
||||||
t2m = getnanotime();
|
t2m = getnanotime();
|
||||||
sum_multi += (t2m - t1m);
|
sum_multi += (t2m - t1m);
|
||||||
the_index.cache_nr = cache_nr_limit;
|
the_index.cache_nr = cache_nr_limit;
|
||||||
discard_cache();
|
discard_index(&the_index);
|
||||||
|
|
||||||
if (!nr_threads_used)
|
if (!nr_threads_used)
|
||||||
printf(" [size %8d] [single %f] non-threaded code path used\n",
|
printf(" [size %8d] [single %f] non-threaded code path used\n",
|
||||||
|
@ -20,7 +20,7 @@ int cmd__read_cache(int argc, const char **argv)
|
|||||||
git_config(git_default_config, NULL);
|
git_config(git_default_config, NULL);
|
||||||
|
|
||||||
for (i = 0; i < cnt; i++) {
|
for (i = 0; i < cnt; i++) {
|
||||||
read_cache();
|
repo_read_index(the_repository);
|
||||||
if (name) {
|
if (name) {
|
||||||
int pos;
|
int pos;
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ int cmd__read_cache(int argc, const char **argv)
|
|||||||
ce_uptodate(the_index.cache[pos]) ? "" : " not");
|
ce_uptodate(the_index.cache[pos]) ? "" : " not");
|
||||||
write_file(name, "%d\n", i);
|
write_file(name, "%d\n", i);
|
||||||
}
|
}
|
||||||
discard_cache();
|
discard_index(&the_index);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,8 @@ int cmd__scrap_cache_tree(int ac, const char **av)
|
|||||||
struct lock_file index_lock = LOCK_INIT;
|
struct lock_file index_lock = LOCK_INIT;
|
||||||
|
|
||||||
setup_git_directory();
|
setup_git_directory();
|
||||||
hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR);
|
repo_hold_locked_index(the_repository, &index_lock, LOCK_DIE_ON_ERROR);
|
||||||
if (read_cache() < 0)
|
if (repo_read_index(the_repository) < 0)
|
||||||
die("unable to read index file");
|
die("unable to read index file");
|
||||||
cache_tree_free(&the_index.cache_tree);
|
cache_tree_free(&the_index.cache_tree);
|
||||||
the_index.cache_tree = NULL;
|
the_index.cache_tree = NULL;
|
||||||
|
@ -9,9 +9,10 @@ int cmd__write_cache(int argc, const char **argv)
|
|||||||
if (argc == 2)
|
if (argc == 2)
|
||||||
cnt = strtol(argv[1], NULL, 0);
|
cnt = strtol(argv[1], NULL, 0);
|
||||||
setup_git_directory();
|
setup_git_directory();
|
||||||
read_cache();
|
repo_read_index(the_repository);
|
||||||
for (i = 0; i < cnt; i++) {
|
for (i = 0; i < cnt; i++) {
|
||||||
hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR);
|
repo_hold_locked_index(the_repository, &index_lock,
|
||||||
|
LOCK_DIE_ON_ERROR);
|
||||||
if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK))
|
if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK))
|
||||||
die("unable to write index file");
|
die("unable to write index file");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user