Skip to content

Commit 7b39a12

Browse files
committed
Merge branch 'ps/the-repository'
More code paths have a repository passed through the callchain, instead of assuming the primary the_repository object. * ps/the-repository: match-trees: stop using `the_repository` graph: stop using `the_repository` add-interactive: stop using `the_repository` tmp-objdir: stop using `the_repository` resolve-undo: stop using `the_repository` credential: stop using `the_repository` mailinfo: stop using `the_repository` diagnose: stop using `the_repository` server-info: stop using `the_repository` send-pack: stop using `the_repository` serve: stop using `the_repository` trace: stop using `the_repository` pager: stop using `the_repository` progress: stop using `the_repository`
2 parents d6a7cac + d4cd757 commit 7b39a12

Some content is hidden

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

74 files changed

+407
-299
lines changed

add-interactive.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#define USE_THE_REPOSITORY_VARIABLE
21
#define DISABLE_SIGN_COMPARE_WARNINGS
32

43
#include "git-compat-util.h"
@@ -72,14 +71,14 @@ void init_add_i_state(struct add_i_state *s, struct repository *r)
7271
s->use_color ? GIT_COLOR_RESET : "", COLOR_MAXLEN);
7372

7473
FREE_AND_NULL(s->interactive_diff_filter);
75-
git_config_get_string("interactive.difffilter",
76-
&s->interactive_diff_filter);
74+
repo_config_get_string(r, "interactive.difffilter",
75+
&s->interactive_diff_filter);
7776

7877
FREE_AND_NULL(s->interactive_diff_algorithm);
79-
git_config_get_string("diff.algorithm",
80-
&s->interactive_diff_algorithm);
78+
repo_config_get_string(r, "diff.algorithm",
79+
&s->interactive_diff_algorithm);
8180

82-
git_config_get_bool("interactive.singlekey", &s->use_single_key);
81+
repo_config_get_bool(r, "interactive.singlekey", &s->use_single_key);
8382
if (s->use_single_key)
8483
setbuf(stdin, NULL);
8584
}
@@ -535,7 +534,7 @@ static int get_modified_files(struct repository *r,
535534
size_t *binary_count)
536535
{
537536
struct object_id head_oid;
538-
int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(the_repository),
537+
int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(r),
539538
"HEAD", RESOLVE_REF_READING,
540539
&head_oid, NULL);
541540
struct collection_status s = { 0 };
@@ -560,7 +559,7 @@ static int get_modified_files(struct repository *r,
560559
s.skip_unseen = filter && i;
561560

562561
opt.def = is_initial ?
563-
empty_tree_oid_hex(the_repository->hash_algo) : oid_to_hex(&head_oid);
562+
empty_tree_oid_hex(r->hash_algo) : oid_to_hex(&head_oid);
564563

565564
repo_init_revisions(r, &rev, NULL);
566565
setup_revisions(0, NULL, &rev, &opt);
@@ -765,7 +764,7 @@ static int run_revert(struct add_i_state *s, const struct pathspec *ps,
765764
size_t count, i, j;
766765

767766
struct object_id oid;
768-
int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(the_repository),
767+
int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(s->r),
769768
"HEAD", RESOLVE_REF_READING,
770769
&oid,
771770
NULL);
@@ -996,7 +995,7 @@ static int run_diff(struct add_i_state *s, const struct pathspec *ps,
996995
ssize_t count, i;
997996

998997
struct object_id oid;
999-
int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(the_repository),
998+
int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(s->r),
1000999
"HEAD", RESOLVE_REF_READING,
10011000
&oid,
10021001
NULL);

add-patch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1464,7 +1464,7 @@ static int patch_update_file(struct add_p_state *s,
14641464
if (file_diff->hunk_nr) {
14651465
if (rendered_hunk_index != hunk_index) {
14661466
if (use_pager) {
1467-
setup_pager();
1467+
setup_pager(the_repository);
14681468
sigchain_push(SIGPIPE, SIG_IGN);
14691469
}
14701470
render_hunk(s, hunk, 0, colored, &s->buf);

builtin/am.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ static int parse_mail(struct am_state *state, const char *mail)
12111211
int ret = 0;
12121212
struct mailinfo mi;
12131213

1214-
setup_mailinfo(&mi);
1214+
setup_mailinfo(the_repository, &mi);
12151215

12161216
if (state->utf8)
12171217
mi.metainfo_charset = get_commit_output_encoding();
@@ -1786,7 +1786,7 @@ static int do_interactive(struct am_state *state)
17861786
}
17871787
strbuf_release(&msg);
17881788
} else if (*reply == 'v' || *reply == 'V') {
1789-
const char *pager = git_pager(1);
1789+
const char *pager = git_pager(the_repository, 1);
17901790
struct child_process cp = CHILD_PROCESS_INIT;
17911791

17921792
if (!pager)
@@ -2246,7 +2246,7 @@ static int show_patch(struct am_state *state, enum resume_type resume_mode)
22462246
if (len < 0)
22472247
die_errno(_("failed to read '%s'"), patch_path);
22482248

2249-
setup_pager();
2249+
setup_pager(the_repository);
22502250
write_in_full(1, sb.buf, sb.len);
22512251
strbuf_release(&sb);
22522252
return 0;

builtin/blame.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,14 +1194,16 @@ int cmd_blame(int argc,
11941194
sb.found_guilty_entry = &found_guilty_entry;
11951195
sb.found_guilty_entry_data = &pi;
11961196
if (show_progress)
1197-
pi.progress = start_delayed_progress(_("Blaming lines"), num_lines);
1197+
pi.progress = start_delayed_progress(the_repository,
1198+
_("Blaming lines"),
1199+
num_lines);
11981200

11991201
assign_blame(&sb, opt);
12001202

12011203
stop_progress(&pi.progress);
12021204

12031205
if (!incremental)
1204-
setup_pager();
1206+
setup_pager(the_repository);
12051207
else
12061208
goto cleanup;
12071209

builtin/bugreport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ int cmd_bugreport(int argc,
167167
strbuf_addftime(&zip_path, option_suffix, localtime_r(&now, &tm), 0, 0);
168168
strbuf_addstr(&zip_path, ".zip");
169169

170-
if (create_diagnostics_archive(&zip_path, diagnose))
170+
if (create_diagnostics_archive(the_repository, &zip_path, diagnose))
171171
die_errno(_("unable to create diagnostics archive %s"), zip_path.buf);
172172

173173
strbuf_release(&zip_path);

builtin/commit-graph.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ static int graph_write(int argc, const char **argv, const char *prefix,
305305
oidset_init(&commits, 0);
306306
if (opts.progress)
307307
progress = start_delayed_progress(
308+
the_repository,
308309
_("Collecting commits from input"), 0);
309310

310311
while (strbuf_getline(&buf, stdin) != EOF) {

builtin/credential.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ int cmd_credential(int argc,
3232
die("unable to read credential from stdin");
3333

3434
if (!strcmp(op, "fill")) {
35-
credential_fill(&c, 0);
35+
credential_fill(the_repository, &c, 0);
3636
credential_next_state(&c);
3737
credential_write(&c, stdout, CREDENTIAL_OP_RESPONSE);
3838
} else if (!strcmp(op, "approve")) {
3939
credential_set_all_capabilities(&c, CREDENTIAL_OP_HELPER);
40-
credential_approve(&c);
40+
credential_approve(the_repository, &c);
4141
} else if (!strcmp(op, "reject")) {
4242
credential_set_all_capabilities(&c, CREDENTIAL_OP_HELPER);
43-
credential_reject(&c);
43+
credential_reject(the_repository, &c);
4444
} else {
4545
usage(usage_msg);
4646
}

builtin/diagnose.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#define USE_THE_REPOSITORY_VARIABLE
2+
13
#include "builtin.h"
24
#include "abspath.h"
35
#include "gettext.h"
@@ -58,7 +60,7 @@ int cmd_diagnose(int argc,
5860
}
5961

6062
/* Prepare diagnostics */
61-
if (create_diagnostics_archive(&zip_path, mode))
63+
if (create_diagnostics_archive(the_repository, &zip_path, mode))
6264
die_errno(_("unable to create diagnostics archive %s"),
6365
zip_path.buf);
6466

builtin/fsck.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ static int traverse_reachable(void)
197197
unsigned int nr = 0;
198198
int result = 0;
199199
if (show_progress)
200-
progress = start_delayed_progress(_("Checking connectivity"), 0);
200+
progress = start_delayed_progress(the_repository,
201+
_("Checking connectivity"), 0);
201202
while (pending.nr) {
202203
result |= traverse_one_object(object_array_pop(&pending));
203204
display_progress(progress, ++nr);
@@ -703,7 +704,8 @@ static void fsck_object_dir(const char *path)
703704
fprintf_ln(stderr, _("Checking object directory"));
704705

705706
if (show_progress)
706-
progress = start_progress(_("Checking object directories"), 256);
707+
progress = start_progress(the_repository,
708+
_("Checking object directories"), 256);
707709

708710
for_each_loose_file_in_objdir(path, fsck_loose, fsck_cruft, fsck_subdir,
709711
&cb_data);
@@ -879,7 +881,8 @@ static int check_pack_rev_indexes(struct repository *r, int show_progress)
879881
if (show_progress) {
880882
for (struct packed_git *p = get_all_packs(r); p; p = p->next)
881883
pack_count++;
882-
progress = start_delayed_progress("Verifying reverse pack-indexes", pack_count);
884+
progress = start_delayed_progress(the_repository,
885+
"Verifying reverse pack-indexes", pack_count);
883886
pack_count = 0;
884887
}
885888

@@ -989,7 +992,8 @@ int cmd_fsck(int argc,
989992
total += p->num_objects;
990993
}
991994

992-
progress = start_progress(_("Checking objects"), total);
995+
progress = start_progress(the_repository,
996+
_("Checking objects"), total);
993997
}
994998
for (p = get_all_packs(the_repository); p;
995999
p = p->next) {

builtin/grep.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ int cmd_grep(int argc,
10841084
}
10851085

10861086
if (show_in_pager == default_pager)
1087-
show_in_pager = git_pager(1);
1087+
show_in_pager = git_pager(the_repository, 1);
10881088
if (show_in_pager) {
10891089
opt.color = 0;
10901090
opt.name_only = 1;
@@ -1246,7 +1246,7 @@ int cmd_grep(int argc,
12461246
}
12471247

12481248
if (!show_in_pager && !opt.status_only)
1249-
setup_pager();
1249+
setup_pager(the_repository);
12501250

12511251
die_for_incompatible_opt3(!use_index, "--no-index",
12521252
untracked, "--untracked",

0 commit comments

Comments
 (0)