Skip to content

Commit 0ab294f

Browse files
committed
Merge branch 'ps/setup-wo-the-repository' into seen
Many uses of the_repository has been updated to use a more appropriate struct repository instance in setup.c codepath. * ps/setup-wo-the-repository: setup: stop using `the_repository` in `init_db()` setup: stop using `the_repository` in `create_reference_database()` setup: stop using `the_repository` in `initialize_repository_version()` setup: stop using `the_repository` in `check_repository_format()` setup: stop using `the_repository` in `upgrade_repository_format()` setup: stop using `the_repository` in `setup_git_directory()` setup: stop using `the_repository` in `setup_git_directory_gently()` setup: stop using `the_repository` in `setup_git_env()` setup: stop using `the_repository` in `set_git_work_tree()` setup: stop using `the_repository` in `setup_work_tree()` setup: stop using `the_repository` in `enter_repo()` setup: stop using `the_repository` in `verify_non_filename()` setup: stop using `the_repository` in `verify_filename()` setup: stop using `the_repository` in `path_inside_repo()` setup: stop using `the_repository` in `prefix_path()` setup: stop using `the_repository` in `is_inside_git_dir()` setup: stop using `the_repository` in `is_inside_worktree()` setup: replace use of `the_repository` in static functions
2 parents 6fd5eb0 + 947d234 commit 0ab294f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+393
-377
lines changed

archive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ int write_archive(int argc, const char **argv, const char *prefix,
786786
* die ourselves; but its error message will be more specific
787787
* than what we could write here.
788788
*/
789-
setup_git_directory();
789+
setup_git_directory(the_repository);
790790
}
791791

792792
parse_treeish_arg(argv, &args, remote);

blame.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2813,7 +2813,7 @@ void setup_scoreboard(struct blame_scoreboard *sb,
28132813
}
28142814

28152815
if (!sb->contents_from)
2816-
setup_work_tree();
2816+
setup_work_tree(the_repository);
28172817

28182818
sb->final = fake_working_tree_commit(sb->repo,
28192819
&sb->revs->diffopt,

builtin/blame.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ static unsigned parse_score(const char *arg)
708708

709709
static char *add_prefix(const char *prefix, const char *path)
710710
{
711-
return prefix_path(prefix, prefix ? strlen(prefix) : 0, path);
711+
return prefix_path(the_repository, prefix, prefix ? strlen(prefix) : 0, path);
712712
}
713713

714714
static int git_blame_config(const char *var, const char *value,

builtin/check-attr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static void check_attr(const char *prefix, struct attr_check *check,
6767

6868
{
6969
char *full_path =
70-
prefix_path(prefix, prefix ? strlen(prefix) : 0, file);
70+
prefix_path(the_repository, prefix, prefix ? strlen(prefix) : 0, file);
7171

7272
if (collect_all) {
7373
git_all_attrs(the_repository->index, full_path, check);
@@ -117,7 +117,7 @@ int cmd_check_attr(int argc,
117117
int cnt, i, doubledash, filei;
118118

119119
if (!is_bare_repository())
120-
setup_work_tree();
120+
setup_work_tree(the_repository);
121121

122122
repo_config(the_repository, git_default_config, NULL);
123123

builtin/check-ref-format.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
/*
22
* GIT - The information manager from hell
33
*/
4+
5+
#define USE_THE_REPOSITORY_VARIABLE
6+
47
#include "builtin.h"
58
#include "refs.h"
69
#include "setup.h"
@@ -41,7 +44,7 @@ static int check_ref_format_branch(const char *arg)
4144
const char *name;
4245
int nongit;
4346

44-
setup_git_directory_gently(&nongit);
47+
setup_git_directory_gently(the_repository, &nongit);
4548
if (check_branch_ref(&sb, arg) ||
4649
!skip_prefix(sb.buf, "refs/heads/", &name))
4750
die("'%s' is not a valid branch name", arg);

builtin/checkout-index.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ int cmd_checkout_index(int argc,
303303
die("git checkout-index: don't mix '--all' and explicit filenames");
304304
if (read_from_stdin)
305305
die("git checkout-index: don't mix '--stdin' and explicit filenames");
306-
p = prefix_path(prefix, prefix_length, arg);
306+
p = prefix_path(repo, prefix, prefix_length, arg);
307307
err |= checkout_file(repo->index, p, prefix);
308308
free(p);
309309
}
@@ -325,7 +325,7 @@ int cmd_checkout_index(int argc,
325325
die("line is badly quoted");
326326
strbuf_swap(&buf, &unquoted);
327327
}
328-
p = prefix_path(prefix, prefix_length, buf.buf);
328+
p = prefix_path(repo, prefix, prefix_length, buf.buf);
329329
err |= checkout_file(repo->index, p, prefix);
330330
free(p);
331331
}

builtin/checkout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1470,7 +1470,7 @@ static int parse_branchname_arg(int argc, const char **argv,
14701470
* it would be extremely annoying.
14711471
*/
14721472
if (argc)
1473-
verify_non_filename(opts->prefix, arg);
1473+
verify_non_filename(the_repository, opts->prefix, arg);
14741474
} else if (opts->accept_pathspec) {
14751475
argcount++;
14761476
argv++;

builtin/clone.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ static int checkout(int submodule_progress,
670670
}
671671

672672
/* We need to be in the new work tree for the checkout */
673-
setup_work_tree();
673+
setup_work_tree(the_repository);
674674

675675
repo_hold_locked_index(the_repository, &lock_file, LOCK_DIE_ON_ERROR);
676676

@@ -1170,7 +1170,7 @@ int cmd_clone(int argc,
11701170
die_errno(_("could not create work tree dir '%s'"),
11711171
work_tree);
11721172
junk_work_tree = work_tree;
1173-
set_git_work_tree(work_tree);
1173+
set_git_work_tree(the_repository, work_tree);
11741174
}
11751175

11761176
if (real_git_dir) {
@@ -1240,7 +1240,7 @@ int cmd_clone(int argc,
12401240
* repository, and reference backends may persist that information into
12411241
* their on-disk data structures.
12421242
*/
1243-
init_db(git_dir, real_git_dir, option_template, GIT_HASH_UNKNOWN,
1243+
init_db(the_repository, git_dir, real_git_dir, option_template, GIT_HASH_UNKNOWN,
12441244
ref_storage_format, NULL,
12451245
do_not_override_repo_unix_permissions, INIT_DB_QUIET | INIT_DB_SKIP_REFDB);
12461246

@@ -1283,7 +1283,7 @@ int cmd_clone(int argc,
12831283
*
12841284
* This is sufficient for Git commands to discover the Git directory.
12851285
*/
1286-
initialize_repository_version(GIT_HASH_UNKNOWN,
1286+
initialize_repository_version(the_repository, GIT_HASH_UNKNOWN,
12871287
the_repository->ref_storage_format, 1);
12881288

12891289
refs_create_refdir_stubs(the_repository, git_dir, NULL);
@@ -1496,9 +1496,9 @@ int cmd_clone(int argc,
14961496
* ours to the same thing.
14971497
*/
14981498
hash_algo = hash_algo_by_ptr(transport_get_hash_algo(transport));
1499-
initialize_repository_version(hash_algo, the_repository->ref_storage_format, 1);
1499+
initialize_repository_version(the_repository, hash_algo, the_repository->ref_storage_format, 1);
15001500
repo_set_hash_algo(the_repository, hash_algo);
1501-
create_reference_database(NULL, 1);
1501+
create_reference_database(the_repository, NULL, 1);
15021502

15031503
/*
15041504
* Before fetching from the remote, download and install bundle

builtin/describe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ int cmd_describe(int argc,
781781
struct rev_info revs;
782782
int fd;
783783

784-
setup_work_tree();
784+
setup_work_tree(the_repository);
785785
prepare_repo_settings(the_repository);
786786
the_repository->settings.command_requires_full_index = 0;
787787
repo_read_index(the_repository);

builtin/diff-index.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ int cmd_diff_index(int argc,
6969
rev.max_count != -1 || rev.min_age != -1 || rev.max_age != -1)
7070
usage(diff_cache_usage);
7171
if (!(option & DIFF_INDEX_CACHED)) {
72-
setup_work_tree();
72+
setup_work_tree(the_repository);
7373
if (repo_read_index_preload(the_repository, &rev.diffopt.pathspec, 0) < 0) {
7474
perror("repo_read_index_preload");
7575
return -1;

0 commit comments

Comments
 (0)