mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
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`
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
#define USE_THE_REPOSITORY_VARIABLE
|
|
||||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||||
|
|
||||||
#include "git-compat-util.h"
|
#include "git-compat-util.h"
|
||||||
@@ -72,14 +71,14 @@ void init_add_i_state(struct add_i_state *s, struct repository *r)
|
|||||||
s->use_color ? GIT_COLOR_RESET : "", COLOR_MAXLEN);
|
s->use_color ? GIT_COLOR_RESET : "", COLOR_MAXLEN);
|
||||||
|
|
||||||
FREE_AND_NULL(s->interactive_diff_filter);
|
FREE_AND_NULL(s->interactive_diff_filter);
|
||||||
git_config_get_string("interactive.difffilter",
|
repo_config_get_string(r, "interactive.difffilter",
|
||||||
&s->interactive_diff_filter);
|
&s->interactive_diff_filter);
|
||||||
|
|
||||||
FREE_AND_NULL(s->interactive_diff_algorithm);
|
FREE_AND_NULL(s->interactive_diff_algorithm);
|
||||||
git_config_get_string("diff.algorithm",
|
repo_config_get_string(r, "diff.algorithm",
|
||||||
&s->interactive_diff_algorithm);
|
&s->interactive_diff_algorithm);
|
||||||
|
|
||||||
git_config_get_bool("interactive.singlekey", &s->use_single_key);
|
repo_config_get_bool(r, "interactive.singlekey", &s->use_single_key);
|
||||||
if (s->use_single_key)
|
if (s->use_single_key)
|
||||||
setbuf(stdin, NULL);
|
setbuf(stdin, NULL);
|
||||||
}
|
}
|
||||||
@@ -535,7 +534,7 @@ static int get_modified_files(struct repository *r,
|
|||||||
size_t *binary_count)
|
size_t *binary_count)
|
||||||
{
|
{
|
||||||
struct object_id head_oid;
|
struct object_id head_oid;
|
||||||
int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(the_repository),
|
int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(r),
|
||||||
"HEAD", RESOLVE_REF_READING,
|
"HEAD", RESOLVE_REF_READING,
|
||||||
&head_oid, NULL);
|
&head_oid, NULL);
|
||||||
struct collection_status s = { 0 };
|
struct collection_status s = { 0 };
|
||||||
@@ -560,7 +559,7 @@ static int get_modified_files(struct repository *r,
|
|||||||
s.skip_unseen = filter && i;
|
s.skip_unseen = filter && i;
|
||||||
|
|
||||||
opt.def = is_initial ?
|
opt.def = is_initial ?
|
||||||
empty_tree_oid_hex(the_repository->hash_algo) : oid_to_hex(&head_oid);
|
empty_tree_oid_hex(r->hash_algo) : oid_to_hex(&head_oid);
|
||||||
|
|
||||||
repo_init_revisions(r, &rev, NULL);
|
repo_init_revisions(r, &rev, NULL);
|
||||||
setup_revisions(0, NULL, &rev, &opt);
|
setup_revisions(0, NULL, &rev, &opt);
|
||||||
@@ -765,7 +764,7 @@ static int run_revert(struct add_i_state *s, const struct pathspec *ps,
|
|||||||
size_t count, i, j;
|
size_t count, i, j;
|
||||||
|
|
||||||
struct object_id oid;
|
struct object_id oid;
|
||||||
int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(the_repository),
|
int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(s->r),
|
||||||
"HEAD", RESOLVE_REF_READING,
|
"HEAD", RESOLVE_REF_READING,
|
||||||
&oid,
|
&oid,
|
||||||
NULL);
|
NULL);
|
||||||
@@ -996,7 +995,7 @@ static int run_diff(struct add_i_state *s, const struct pathspec *ps,
|
|||||||
ssize_t count, i;
|
ssize_t count, i;
|
||||||
|
|
||||||
struct object_id oid;
|
struct object_id oid;
|
||||||
int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(the_repository),
|
int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(s->r),
|
||||||
"HEAD", RESOLVE_REF_READING,
|
"HEAD", RESOLVE_REF_READING,
|
||||||
&oid,
|
&oid,
|
||||||
NULL);
|
NULL);
|
||||||
|
|||||||
@@ -1464,7 +1464,7 @@ static int patch_update_file(struct add_p_state *s,
|
|||||||
if (file_diff->hunk_nr) {
|
if (file_diff->hunk_nr) {
|
||||||
if (rendered_hunk_index != hunk_index) {
|
if (rendered_hunk_index != hunk_index) {
|
||||||
if (use_pager) {
|
if (use_pager) {
|
||||||
setup_pager();
|
setup_pager(the_repository);
|
||||||
sigchain_push(SIGPIPE, SIG_IGN);
|
sigchain_push(SIGPIPE, SIG_IGN);
|
||||||
}
|
}
|
||||||
render_hunk(s, hunk, 0, colored, &s->buf);
|
render_hunk(s, hunk, 0, colored, &s->buf);
|
||||||
|
|||||||
@@ -1211,7 +1211,7 @@ static int parse_mail(struct am_state *state, const char *mail)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct mailinfo mi;
|
struct mailinfo mi;
|
||||||
|
|
||||||
setup_mailinfo(&mi);
|
setup_mailinfo(the_repository, &mi);
|
||||||
|
|
||||||
if (state->utf8)
|
if (state->utf8)
|
||||||
mi.metainfo_charset = get_commit_output_encoding();
|
mi.metainfo_charset = get_commit_output_encoding();
|
||||||
@@ -1786,7 +1786,7 @@ static int do_interactive(struct am_state *state)
|
|||||||
}
|
}
|
||||||
strbuf_release(&msg);
|
strbuf_release(&msg);
|
||||||
} else if (*reply == 'v' || *reply == 'V') {
|
} else if (*reply == 'v' || *reply == 'V') {
|
||||||
const char *pager = git_pager(1);
|
const char *pager = git_pager(the_repository, 1);
|
||||||
struct child_process cp = CHILD_PROCESS_INIT;
|
struct child_process cp = CHILD_PROCESS_INIT;
|
||||||
|
|
||||||
if (!pager)
|
if (!pager)
|
||||||
@@ -2246,7 +2246,7 @@ static int show_patch(struct am_state *state, enum resume_type resume_mode)
|
|||||||
if (len < 0)
|
if (len < 0)
|
||||||
die_errno(_("failed to read '%s'"), patch_path);
|
die_errno(_("failed to read '%s'"), patch_path);
|
||||||
|
|
||||||
setup_pager();
|
setup_pager(the_repository);
|
||||||
write_in_full(1, sb.buf, sb.len);
|
write_in_full(1, sb.buf, sb.len);
|
||||||
strbuf_release(&sb);
|
strbuf_release(&sb);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -1194,14 +1194,16 @@ parse_done:
|
|||||||
sb.found_guilty_entry = &found_guilty_entry;
|
sb.found_guilty_entry = &found_guilty_entry;
|
||||||
sb.found_guilty_entry_data = π
|
sb.found_guilty_entry_data = π
|
||||||
if (show_progress)
|
if (show_progress)
|
||||||
pi.progress = start_delayed_progress(_("Blaming lines"), num_lines);
|
pi.progress = start_delayed_progress(the_repository,
|
||||||
|
_("Blaming lines"),
|
||||||
|
num_lines);
|
||||||
|
|
||||||
assign_blame(&sb, opt);
|
assign_blame(&sb, opt);
|
||||||
|
|
||||||
stop_progress(&pi.progress);
|
stop_progress(&pi.progress);
|
||||||
|
|
||||||
if (!incremental)
|
if (!incremental)
|
||||||
setup_pager();
|
setup_pager(the_repository);
|
||||||
else
|
else
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ int cmd_bugreport(int argc,
|
|||||||
strbuf_addftime(&zip_path, option_suffix, localtime_r(&now, &tm), 0, 0);
|
strbuf_addftime(&zip_path, option_suffix, localtime_r(&now, &tm), 0, 0);
|
||||||
strbuf_addstr(&zip_path, ".zip");
|
strbuf_addstr(&zip_path, ".zip");
|
||||||
|
|
||||||
if (create_diagnostics_archive(&zip_path, diagnose))
|
if (create_diagnostics_archive(the_repository, &zip_path, diagnose))
|
||||||
die_errno(_("unable to create diagnostics archive %s"), zip_path.buf);
|
die_errno(_("unable to create diagnostics archive %s"), zip_path.buf);
|
||||||
|
|
||||||
strbuf_release(&zip_path);
|
strbuf_release(&zip_path);
|
||||||
|
|||||||
@@ -305,6 +305,7 @@ static int graph_write(int argc, const char **argv, const char *prefix,
|
|||||||
oidset_init(&commits, 0);
|
oidset_init(&commits, 0);
|
||||||
if (opts.progress)
|
if (opts.progress)
|
||||||
progress = start_delayed_progress(
|
progress = start_delayed_progress(
|
||||||
|
the_repository,
|
||||||
_("Collecting commits from input"), 0);
|
_("Collecting commits from input"), 0);
|
||||||
|
|
||||||
while (strbuf_getline(&buf, stdin) != EOF) {
|
while (strbuf_getline(&buf, stdin) != EOF) {
|
||||||
|
|||||||
@@ -32,15 +32,15 @@ int cmd_credential(int argc,
|
|||||||
die("unable to read credential from stdin");
|
die("unable to read credential from stdin");
|
||||||
|
|
||||||
if (!strcmp(op, "fill")) {
|
if (!strcmp(op, "fill")) {
|
||||||
credential_fill(&c, 0);
|
credential_fill(the_repository, &c, 0);
|
||||||
credential_next_state(&c);
|
credential_next_state(&c);
|
||||||
credential_write(&c, stdout, CREDENTIAL_OP_RESPONSE);
|
credential_write(&c, stdout, CREDENTIAL_OP_RESPONSE);
|
||||||
} else if (!strcmp(op, "approve")) {
|
} else if (!strcmp(op, "approve")) {
|
||||||
credential_set_all_capabilities(&c, CREDENTIAL_OP_HELPER);
|
credential_set_all_capabilities(&c, CREDENTIAL_OP_HELPER);
|
||||||
credential_approve(&c);
|
credential_approve(the_repository, &c);
|
||||||
} else if (!strcmp(op, "reject")) {
|
} else if (!strcmp(op, "reject")) {
|
||||||
credential_set_all_capabilities(&c, CREDENTIAL_OP_HELPER);
|
credential_set_all_capabilities(&c, CREDENTIAL_OP_HELPER);
|
||||||
credential_reject(&c);
|
credential_reject(the_repository, &c);
|
||||||
} else {
|
} else {
|
||||||
usage(usage_msg);
|
usage(usage_msg);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#define USE_THE_REPOSITORY_VARIABLE
|
||||||
|
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "abspath.h"
|
#include "abspath.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
@@ -58,7 +60,7 @@ int cmd_diagnose(int argc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Prepare diagnostics */
|
/* Prepare diagnostics */
|
||||||
if (create_diagnostics_archive(&zip_path, mode))
|
if (create_diagnostics_archive(the_repository, &zip_path, mode))
|
||||||
die_errno(_("unable to create diagnostics archive %s"),
|
die_errno(_("unable to create diagnostics archive %s"),
|
||||||
zip_path.buf);
|
zip_path.buf);
|
||||||
|
|
||||||
|
|||||||
@@ -197,7 +197,8 @@ static int traverse_reachable(void)
|
|||||||
unsigned int nr = 0;
|
unsigned int nr = 0;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
if (show_progress)
|
if (show_progress)
|
||||||
progress = start_delayed_progress(_("Checking connectivity"), 0);
|
progress = start_delayed_progress(the_repository,
|
||||||
|
_("Checking connectivity"), 0);
|
||||||
while (pending.nr) {
|
while (pending.nr) {
|
||||||
result |= traverse_one_object(object_array_pop(&pending));
|
result |= traverse_one_object(object_array_pop(&pending));
|
||||||
display_progress(progress, ++nr);
|
display_progress(progress, ++nr);
|
||||||
@@ -703,7 +704,8 @@ static void fsck_object_dir(const char *path)
|
|||||||
fprintf_ln(stderr, _("Checking object directory"));
|
fprintf_ln(stderr, _("Checking object directory"));
|
||||||
|
|
||||||
if (show_progress)
|
if (show_progress)
|
||||||
progress = start_progress(_("Checking object directories"), 256);
|
progress = start_progress(the_repository,
|
||||||
|
_("Checking object directories"), 256);
|
||||||
|
|
||||||
for_each_loose_file_in_objdir(path, fsck_loose, fsck_cruft, fsck_subdir,
|
for_each_loose_file_in_objdir(path, fsck_loose, fsck_cruft, fsck_subdir,
|
||||||
&cb_data);
|
&cb_data);
|
||||||
@@ -879,7 +881,8 @@ static int check_pack_rev_indexes(struct repository *r, int show_progress)
|
|||||||
if (show_progress) {
|
if (show_progress) {
|
||||||
for (struct packed_git *p = get_all_packs(r); p; p = p->next)
|
for (struct packed_git *p = get_all_packs(r); p; p = p->next)
|
||||||
pack_count++;
|
pack_count++;
|
||||||
progress = start_delayed_progress("Verifying reverse pack-indexes", pack_count);
|
progress = start_delayed_progress(the_repository,
|
||||||
|
"Verifying reverse pack-indexes", pack_count);
|
||||||
pack_count = 0;
|
pack_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -989,7 +992,8 @@ int cmd_fsck(int argc,
|
|||||||
total += p->num_objects;
|
total += p->num_objects;
|
||||||
}
|
}
|
||||||
|
|
||||||
progress = start_progress(_("Checking objects"), total);
|
progress = start_progress(the_repository,
|
||||||
|
_("Checking objects"), total);
|
||||||
}
|
}
|
||||||
for (p = get_all_packs(the_repository); p;
|
for (p = get_all_packs(the_repository); p;
|
||||||
p = p->next) {
|
p = p->next) {
|
||||||
|
|||||||
@@ -1084,7 +1084,7 @@ int cmd_grep(int argc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (show_in_pager == default_pager)
|
if (show_in_pager == default_pager)
|
||||||
show_in_pager = git_pager(1);
|
show_in_pager = git_pager(the_repository, 1);
|
||||||
if (show_in_pager) {
|
if (show_in_pager) {
|
||||||
opt.color = 0;
|
opt.color = 0;
|
||||||
opt.name_only = 1;
|
opt.name_only = 1;
|
||||||
@@ -1246,7 +1246,7 @@ int cmd_grep(int argc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!show_in_pager && !opt.status_only)
|
if (!show_in_pager && !opt.status_only)
|
||||||
setup_pager();
|
setup_pager(the_repository);
|
||||||
|
|
||||||
die_for_incompatible_opt3(!use_index, "--no-index",
|
die_for_incompatible_opt3(!use_index, "--no-index",
|
||||||
untracked, "--untracked",
|
untracked, "--untracked",
|
||||||
|
|||||||
@@ -658,7 +658,7 @@ int cmd_help(int argc,
|
|||||||
case HELP_ACTION_ALL:
|
case HELP_ACTION_ALL:
|
||||||
opt_mode_usage(argc, "--all", help_format);
|
opt_mode_usage(argc, "--all", help_format);
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
setup_pager();
|
setup_pager(the_repository);
|
||||||
list_all_cmds_help(show_external_commands,
|
list_all_cmds_help(show_external_commands,
|
||||||
show_aliases);
|
show_aliases);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -692,7 +692,7 @@ int cmd_help(int argc,
|
|||||||
return 0;
|
return 0;
|
||||||
case HELP_ACTION_CONFIG:
|
case HELP_ACTION_CONFIG:
|
||||||
opt_mode_usage(argc, "--config", help_format);
|
opt_mode_usage(argc, "--config", help_format);
|
||||||
setup_pager();
|
setup_pager(the_repository);
|
||||||
list_config_help(SHOW_CONFIG_HUMAN);
|
list_config_help(SHOW_CONFIG_HUMAN);
|
||||||
printf("\n%s\n", _("'git help config' for more information"));
|
printf("\n%s\n", _("'git help config' for more information"));
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -282,7 +282,8 @@ static unsigned check_objects(void)
|
|||||||
max = get_max_object_index();
|
max = get_max_object_index();
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
progress = start_delayed_progress(_("Checking objects"), max);
|
progress = start_delayed_progress(the_repository,
|
||||||
|
_("Checking objects"), max);
|
||||||
|
|
||||||
for (i = 0; i < max; i++) {
|
for (i = 0; i < max; i++) {
|
||||||
foreign_nr += check_object(get_indexed_object(i));
|
foreign_nr += check_object(get_indexed_object(i));
|
||||||
@@ -1249,6 +1250,7 @@ static void parse_pack_objects(unsigned char *hash)
|
|||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
progress = start_progress(
|
progress = start_progress(
|
||||||
|
the_repository,
|
||||||
progress_title ? progress_title :
|
progress_title ? progress_title :
|
||||||
from_stdin ? _("Receiving objects") : _("Indexing objects"),
|
from_stdin ? _("Receiving objects") : _("Indexing objects"),
|
||||||
nr_objects);
|
nr_objects);
|
||||||
@@ -1329,7 +1331,8 @@ static void resolve_deltas(struct pack_idx_option *opts)
|
|||||||
QSORT(ref_deltas, nr_ref_deltas, compare_ref_delta_entry);
|
QSORT(ref_deltas, nr_ref_deltas, compare_ref_delta_entry);
|
||||||
|
|
||||||
if (verbose || show_resolving_progress)
|
if (verbose || show_resolving_progress)
|
||||||
progress = start_progress(_("Resolving deltas"),
|
progress = start_progress(the_repository,
|
||||||
|
_("Resolving deltas"),
|
||||||
nr_ref_deltas + nr_ofs_deltas);
|
nr_ref_deltas + nr_ofs_deltas);
|
||||||
|
|
||||||
nr_dispatched = 0;
|
nr_dispatched = 0;
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
|
|||||||
if (rev->line_level_traverse)
|
if (rev->line_level_traverse)
|
||||||
line_log_init(rev, line_cb.prefix, &line_cb.args);
|
line_log_init(rev, line_cb.prefix, &line_cb.args);
|
||||||
|
|
||||||
setup_pager();
|
setup_pager(the_repository);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cmd_log_init(int argc, const char **argv, const char *prefix,
|
static void cmd_log_init(int argc, const char **argv, const char *prefix,
|
||||||
@@ -2295,7 +2295,7 @@ int cmd_format_patch(int argc,
|
|||||||
rev.commit_format = CMIT_FMT_MBOXRD;
|
rev.commit_format = CMIT_FMT_MBOXRD;
|
||||||
|
|
||||||
if (use_stdout) {
|
if (use_stdout) {
|
||||||
setup_pager();
|
setup_pager(the_repository);
|
||||||
} else if (!rev.diffopt.close_file) {
|
} else if (!rev.diffopt.close_file) {
|
||||||
int saved;
|
int saved;
|
||||||
|
|
||||||
@@ -2498,7 +2498,8 @@ int cmd_format_patch(int argc,
|
|||||||
rev.add_signoff = cfg.do_signoff;
|
rev.add_signoff = cfg.do_signoff;
|
||||||
|
|
||||||
if (show_progress)
|
if (show_progress)
|
||||||
progress = start_delayed_progress(_("Generating patches"), total);
|
progress = start_delayed_progress(the_repository,
|
||||||
|
_("Generating patches"), total);
|
||||||
for (i = 0; i < nr; i++) {
|
for (i = 0; i < nr; i++) {
|
||||||
size_t idx = nr - i - 1;
|
size_t idx = nr - i - 1;
|
||||||
int shown;
|
int shown;
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ int cmd_mailinfo(int argc,
|
|||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
setup_mailinfo(&mi);
|
setup_mailinfo(the_repository, &mi);
|
||||||
meta_charset.policy = CHARSET_DEFAULT;
|
meta_charset.policy = CHARSET_DEFAULT;
|
||||||
|
|
||||||
argc = parse_options(argc, argv, prefix, options, mailinfo_usage, 0);
|
argc = parse_options(argc, argv, prefix, options, mailinfo_usage, 0);
|
||||||
|
|||||||
@@ -1264,7 +1264,8 @@ static void write_pack_file(void)
|
|||||||
struct object_entry **write_order;
|
struct object_entry **write_order;
|
||||||
|
|
||||||
if (progress > pack_to_stdout)
|
if (progress > pack_to_stdout)
|
||||||
progress_state = start_progress(_("Writing objects"), nr_result);
|
progress_state = start_progress(the_repository,
|
||||||
|
_("Writing objects"), nr_result);
|
||||||
ALLOC_ARRAY(written_list, to_pack.nr_objects);
|
ALLOC_ARRAY(written_list, to_pack.nr_objects);
|
||||||
write_order = compute_write_order();
|
write_order = compute_write_order();
|
||||||
|
|
||||||
@@ -2400,7 +2401,8 @@ static void get_object_details(void)
|
|||||||
struct object_entry **sorted_by_offset;
|
struct object_entry **sorted_by_offset;
|
||||||
|
|
||||||
if (progress)
|
if (progress)
|
||||||
progress_state = start_progress(_("Counting objects"),
|
progress_state = start_progress(the_repository,
|
||||||
|
_("Counting objects"),
|
||||||
to_pack.nr_objects);
|
to_pack.nr_objects);
|
||||||
|
|
||||||
CALLOC_ARRAY(sorted_by_offset, to_pack.nr_objects);
|
CALLOC_ARRAY(sorted_by_offset, to_pack.nr_objects);
|
||||||
@@ -3220,7 +3222,8 @@ static void prepare_pack(int window, int depth)
|
|||||||
unsigned nr_done = 0;
|
unsigned nr_done = 0;
|
||||||
|
|
||||||
if (progress)
|
if (progress)
|
||||||
progress_state = start_progress(_("Compressing objects"),
|
progress_state = start_progress(the_repository,
|
||||||
|
_("Compressing objects"),
|
||||||
nr_deltas);
|
nr_deltas);
|
||||||
QSORT(delta_list, n, type_size_sort);
|
QSORT(delta_list, n, type_size_sort);
|
||||||
ll_find_deltas(delta_list, n, window+1, depth, &nr_done);
|
ll_find_deltas(delta_list, n, window+1, depth, &nr_done);
|
||||||
@@ -3648,7 +3651,8 @@ static void add_objects_in_unpacked_packs(void);
|
|||||||
static void enumerate_cruft_objects(void)
|
static void enumerate_cruft_objects(void)
|
||||||
{
|
{
|
||||||
if (progress)
|
if (progress)
|
||||||
progress_state = start_progress(_("Enumerating cruft objects"), 0);
|
progress_state = start_progress(the_repository,
|
||||||
|
_("Enumerating cruft objects"), 0);
|
||||||
|
|
||||||
add_objects_in_unpacked_packs();
|
add_objects_in_unpacked_packs();
|
||||||
add_unreachable_loose_objects();
|
add_unreachable_loose_objects();
|
||||||
@@ -3674,7 +3678,8 @@ static void enumerate_and_traverse_cruft_objects(struct string_list *fresh_packs
|
|||||||
revs.ignore_missing_links = 1;
|
revs.ignore_missing_links = 1;
|
||||||
|
|
||||||
if (progress)
|
if (progress)
|
||||||
progress_state = start_progress(_("Enumerating cruft objects"), 0);
|
progress_state = start_progress(the_repository,
|
||||||
|
_("Enumerating cruft objects"), 0);
|
||||||
ret = add_unseen_recent_objects_to_traversal(&revs, cruft_expiration,
|
ret = add_unseen_recent_objects_to_traversal(&revs, cruft_expiration,
|
||||||
set_cruft_mtime, 1);
|
set_cruft_mtime, 1);
|
||||||
stop_progress(&progress_state);
|
stop_progress(&progress_state);
|
||||||
@@ -3693,7 +3698,8 @@ static void enumerate_and_traverse_cruft_objects(struct string_list *fresh_packs
|
|||||||
if (prepare_revision_walk(&revs))
|
if (prepare_revision_walk(&revs))
|
||||||
die(_("revision walk setup failed"));
|
die(_("revision walk setup failed"));
|
||||||
if (progress)
|
if (progress)
|
||||||
progress_state = start_progress(_("Traversing cruft objects"), 0);
|
progress_state = start_progress(the_repository,
|
||||||
|
_("Traversing cruft objects"), 0);
|
||||||
nr_seen = 0;
|
nr_seen = 0;
|
||||||
traverse_commit_list(&revs, show_cruft_commit, show_cruft_object, NULL);
|
traverse_commit_list(&revs, show_cruft_commit, show_cruft_object, NULL);
|
||||||
|
|
||||||
@@ -4625,7 +4631,8 @@ int cmd_pack_objects(int argc,
|
|||||||
prepare_packing_data(the_repository, &to_pack);
|
prepare_packing_data(the_repository, &to_pack);
|
||||||
|
|
||||||
if (progress && !cruft)
|
if (progress && !cruft)
|
||||||
progress_state = start_progress(_("Enumerating objects"), 0);
|
progress_state = start_progress(the_repository,
|
||||||
|
_("Enumerating objects"), 0);
|
||||||
if (stdin_packs) {
|
if (stdin_packs) {
|
||||||
/* avoids adding objects in excluded packs */
|
/* avoids adding objects in excluded packs */
|
||||||
ignore_packed_keep_in_core = 1;
|
ignore_packed_keep_in_core = 1;
|
||||||
|
|||||||
@@ -64,7 +64,8 @@ static void perform_reachability_traversal(struct rev_info *revs)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (show_progress)
|
if (show_progress)
|
||||||
progress = start_delayed_progress(_("Checking connectivity"), 0);
|
progress = start_delayed_progress(the_repository,
|
||||||
|
_("Checking connectivity"), 0);
|
||||||
mark_reachable_objects(revs, 1, expire, progress);
|
mark_reachable_objects(revs, 1, expire, progress);
|
||||||
stop_progress(&progress);
|
stop_progress(&progress);
|
||||||
initialized = 1;
|
initialized = 1;
|
||||||
|
|||||||
@@ -2239,7 +2239,7 @@ static const char *unpack(int err_fd, struct shallow_info *si)
|
|||||||
strvec_push(&child.args, alt_shallow_file);
|
strvec_push(&child.args, alt_shallow_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp_objdir = tmp_objdir_create("incoming");
|
tmp_objdir = tmp_objdir_create(the_repository, "incoming");
|
||||||
if (!tmp_objdir) {
|
if (!tmp_objdir) {
|
||||||
if (err_fd > 0)
|
if (err_fd > 0)
|
||||||
close(err_fd);
|
close(err_fd);
|
||||||
@@ -2628,7 +2628,7 @@ int cmd_receive_pack(int argc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (auto_update_server_info)
|
if (auto_update_server_info)
|
||||||
update_server_info(0);
|
update_server_info(the_repository, 0);
|
||||||
clear_shallow_info(&si);
|
clear_shallow_info(&si);
|
||||||
}
|
}
|
||||||
if (use_sideband)
|
if (use_sideband)
|
||||||
|
|||||||
@@ -820,7 +820,8 @@ static int mv(int argc, const char **argv, const char *prefix,
|
|||||||
* Count symrefs twice, since "renaming" them is done by
|
* Count symrefs twice, since "renaming" them is done by
|
||||||
* deleting and recreating them in two separate passes.
|
* deleting and recreating them in two separate passes.
|
||||||
*/
|
*/
|
||||||
progress = start_progress(_("Renaming remote references"),
|
progress = start_progress(the_repository,
|
||||||
|
_("Renaming remote references"),
|
||||||
rename.remote_branches->nr + rename.symrefs_nr);
|
rename.remote_branches->nr + rename.symrefs_nr);
|
||||||
}
|
}
|
||||||
for (i = 0; i < remote_branches.nr; i++) {
|
for (i = 0; i < remote_branches.nr; i++) {
|
||||||
|
|||||||
@@ -1565,7 +1565,7 @@ int cmd_repack(int argc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (run_update_server_info)
|
if (run_update_server_info)
|
||||||
update_server_info(0);
|
update_server_info(the_repository, 0);
|
||||||
|
|
||||||
if (git_env_bool(GIT_TEST_MULTI_PACK_INDEX, 0)) {
|
if (git_env_bool(GIT_TEST_MULTI_PACK_INDEX, 0)) {
|
||||||
unsigned flags = 0;
|
unsigned flags = 0;
|
||||||
|
|||||||
@@ -735,7 +735,8 @@ int cmd_rev_list(int argc,
|
|||||||
revs.limited = 1;
|
revs.limited = 1;
|
||||||
|
|
||||||
if (show_progress)
|
if (show_progress)
|
||||||
progress = start_delayed_progress(show_progress, 0);
|
progress = start_delayed_progress(the_repository,
|
||||||
|
show_progress, 0);
|
||||||
|
|
||||||
if (use_bitmap_index) {
|
if (use_bitmap_index) {
|
||||||
if (!try_bitmap_count(&revs, filter_provided_objects))
|
if (!try_bitmap_count(&revs, filter_provided_objects))
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ int cmd_send_pack(int argc,
|
|||||||
set_ref_status_for_push(remote_refs, args.send_mirror,
|
set_ref_status_for_push(remote_refs, args.send_mirror,
|
||||||
args.force_update);
|
args.force_update);
|
||||||
|
|
||||||
ret = send_pack(&args, fd, conn, remote_refs, &extra_have);
|
ret = send_pack(the_repository, &args, fd, conn, remote_refs, &extra_have);
|
||||||
|
|
||||||
if (helper_status)
|
if (helper_status)
|
||||||
print_helper_status(remote_refs);
|
print_helper_status(remote_refs);
|
||||||
|
|||||||
@@ -590,7 +590,8 @@ static void unpack_all(void)
|
|||||||
use(sizeof(struct pack_header));
|
use(sizeof(struct pack_header));
|
||||||
|
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
progress = start_progress(_("Unpacking objects"), nr_objects);
|
progress = start_progress(the_repository,
|
||||||
|
_("Unpacking objects"), nr_objects);
|
||||||
CALLOC_ARRAY(obj_list, nr_objects);
|
CALLOC_ARRAY(obj_list, nr_objects);
|
||||||
begin_odb_transaction();
|
begin_odb_transaction();
|
||||||
for (i = 0; i < nr_objects; i++) {
|
for (i = 0; i < nr_objects; i++) {
|
||||||
|
|||||||
@@ -27,5 +27,5 @@ int cmd_update_server_info(int argc,
|
|||||||
if (argc > 0)
|
if (argc > 0)
|
||||||
usage_with_options(update_server_info_usage, options);
|
usage_with_options(update_server_info_usage, options);
|
||||||
|
|
||||||
return !!update_server_info(force);
|
return !!update_server_info(the_repository, force);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#define USE_THE_REPOSITORY_VARIABLE
|
||||||
|
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "exec-cmd.h"
|
#include "exec-cmd.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
@@ -63,9 +65,9 @@ int cmd_upload_pack(int argc,
|
|||||||
switch (determine_protocol_version_server()) {
|
switch (determine_protocol_version_server()) {
|
||||||
case protocol_v2:
|
case protocol_v2:
|
||||||
if (advertise_refs)
|
if (advertise_refs)
|
||||||
protocol_v2_advertise_capabilities();
|
protocol_v2_advertise_capabilities(the_repository);
|
||||||
else
|
else
|
||||||
protocol_v2_serve_loop(stateless_rpc);
|
protocol_v2_serve_loop(the_repository, stateless_rpc);
|
||||||
break;
|
break;
|
||||||
case protocol_v1:
|
case protocol_v1:
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ static char *sequence_editor(int ident_flag UNUSED)
|
|||||||
|
|
||||||
static char *pager(int ident_flag UNUSED)
|
static char *pager(int ident_flag UNUSED)
|
||||||
{
|
{
|
||||||
const char *pgm = git_pager(1);
|
const char *pgm = git_pager(the_repository, 1);
|
||||||
|
|
||||||
if (!pgm)
|
if (!pgm)
|
||||||
pgm = "cat";
|
pgm = "cat";
|
||||||
|
|||||||
@@ -333,7 +333,7 @@ void prepare_loose_object_bulk_checkin(void)
|
|||||||
if (!odb_transaction_nesting || bulk_fsync_objdir)
|
if (!odb_transaction_nesting || bulk_fsync_objdir)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bulk_fsync_objdir = tmp_objdir_create("bulk-fsync");
|
bulk_fsync_objdir = tmp_objdir_create(the_repository, "bulk-fsync");
|
||||||
if (bulk_fsync_objdir)
|
if (bulk_fsync_objdir)
|
||||||
tmp_objdir_replace_primary_odb(bulk_fsync_objdir, 0);
|
tmp_objdir_replace_primary_odb(bulk_fsync_objdir, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1534,6 +1534,7 @@ static void close_reachable(struct write_commit_graph_context *ctx)
|
|||||||
|
|
||||||
if (ctx->report_progress)
|
if (ctx->report_progress)
|
||||||
ctx->progress = start_delayed_progress(
|
ctx->progress = start_delayed_progress(
|
||||||
|
the_repository,
|
||||||
_("Loading known commits in commit graph"),
|
_("Loading known commits in commit graph"),
|
||||||
ctx->oids.nr);
|
ctx->oids.nr);
|
||||||
for (i = 0; i < ctx->oids.nr; i++) {
|
for (i = 0; i < ctx->oids.nr; i++) {
|
||||||
@@ -1551,6 +1552,7 @@ static void close_reachable(struct write_commit_graph_context *ctx)
|
|||||||
*/
|
*/
|
||||||
if (ctx->report_progress)
|
if (ctx->report_progress)
|
||||||
ctx->progress = start_delayed_progress(
|
ctx->progress = start_delayed_progress(
|
||||||
|
the_repository,
|
||||||
_("Expanding reachable commits in commit graph"),
|
_("Expanding reachable commits in commit graph"),
|
||||||
0);
|
0);
|
||||||
for (i = 0; i < ctx->oids.nr; i++) {
|
for (i = 0; i < ctx->oids.nr; i++) {
|
||||||
@@ -1571,6 +1573,7 @@ static void close_reachable(struct write_commit_graph_context *ctx)
|
|||||||
|
|
||||||
if (ctx->report_progress)
|
if (ctx->report_progress)
|
||||||
ctx->progress = start_delayed_progress(
|
ctx->progress = start_delayed_progress(
|
||||||
|
the_repository,
|
||||||
_("Clearing commit marks in commit graph"),
|
_("Clearing commit marks in commit graph"),
|
||||||
ctx->oids.nr);
|
ctx->oids.nr);
|
||||||
for (i = 0; i < ctx->oids.nr; i++) {
|
for (i = 0; i < ctx->oids.nr; i++) {
|
||||||
@@ -1688,6 +1691,7 @@ static void compute_topological_levels(struct write_commit_graph_context *ctx)
|
|||||||
if (ctx->report_progress)
|
if (ctx->report_progress)
|
||||||
info.progress = ctx->progress
|
info.progress = ctx->progress
|
||||||
= start_delayed_progress(
|
= start_delayed_progress(
|
||||||
|
the_repository,
|
||||||
_("Computing commit graph topological levels"),
|
_("Computing commit graph topological levels"),
|
||||||
ctx->commits.nr);
|
ctx->commits.nr);
|
||||||
|
|
||||||
@@ -1722,6 +1726,7 @@ static void compute_generation_numbers(struct write_commit_graph_context *ctx)
|
|||||||
if (ctx->report_progress)
|
if (ctx->report_progress)
|
||||||
info.progress = ctx->progress
|
info.progress = ctx->progress
|
||||||
= start_delayed_progress(
|
= start_delayed_progress(
|
||||||
|
the_repository,
|
||||||
_("Computing commit graph generation numbers"),
|
_("Computing commit graph generation numbers"),
|
||||||
ctx->commits.nr);
|
ctx->commits.nr);
|
||||||
|
|
||||||
@@ -1798,6 +1803,7 @@ static void compute_bloom_filters(struct write_commit_graph_context *ctx)
|
|||||||
|
|
||||||
if (ctx->report_progress)
|
if (ctx->report_progress)
|
||||||
progress = start_delayed_progress(
|
progress = start_delayed_progress(
|
||||||
|
the_repository,
|
||||||
_("Computing commit changed paths Bloom filters"),
|
_("Computing commit changed paths Bloom filters"),
|
||||||
ctx->commits.nr);
|
ctx->commits.nr);
|
||||||
|
|
||||||
@@ -1877,6 +1883,7 @@ int write_commit_graph_reachable(struct object_directory *odb,
|
|||||||
data.commits = &commits;
|
data.commits = &commits;
|
||||||
if (flags & COMMIT_GRAPH_WRITE_PROGRESS)
|
if (flags & COMMIT_GRAPH_WRITE_PROGRESS)
|
||||||
data.progress = start_delayed_progress(
|
data.progress = start_delayed_progress(
|
||||||
|
the_repository,
|
||||||
_("Collecting referenced commits"), 0);
|
_("Collecting referenced commits"), 0);
|
||||||
|
|
||||||
refs_for_each_ref(get_main_ref_store(the_repository), add_ref_to_set,
|
refs_for_each_ref(get_main_ref_store(the_repository), add_ref_to_set,
|
||||||
@@ -1908,7 +1915,8 @@ static int fill_oids_from_packs(struct write_commit_graph_context *ctx,
|
|||||||
"Finding commits for commit graph in %"PRIuMAX" packs",
|
"Finding commits for commit graph in %"PRIuMAX" packs",
|
||||||
pack_indexes->nr),
|
pack_indexes->nr),
|
||||||
(uintmax_t)pack_indexes->nr);
|
(uintmax_t)pack_indexes->nr);
|
||||||
ctx->progress = start_delayed_progress(progress_title.buf, 0);
|
ctx->progress = start_delayed_progress(the_repository,
|
||||||
|
progress_title.buf, 0);
|
||||||
ctx->progress_done = 0;
|
ctx->progress_done = 0;
|
||||||
}
|
}
|
||||||
for (i = 0; i < pack_indexes->nr; i++) {
|
for (i = 0; i < pack_indexes->nr; i++) {
|
||||||
@@ -1959,6 +1967,7 @@ static void fill_oids_from_all_packs(struct write_commit_graph_context *ctx)
|
|||||||
{
|
{
|
||||||
if (ctx->report_progress)
|
if (ctx->report_progress)
|
||||||
ctx->progress = start_delayed_progress(
|
ctx->progress = start_delayed_progress(
|
||||||
|
the_repository,
|
||||||
_("Finding commits for commit graph among packed objects"),
|
_("Finding commits for commit graph among packed objects"),
|
||||||
ctx->approx_nr_objects);
|
ctx->approx_nr_objects);
|
||||||
for_each_packed_object(ctx->r, add_packed_commits, ctx,
|
for_each_packed_object(ctx->r, add_packed_commits, ctx,
|
||||||
@@ -1977,6 +1986,7 @@ static void copy_oids_to_commits(struct write_commit_graph_context *ctx)
|
|||||||
ctx->num_extra_edges = 0;
|
ctx->num_extra_edges = 0;
|
||||||
if (ctx->report_progress)
|
if (ctx->report_progress)
|
||||||
ctx->progress = start_delayed_progress(
|
ctx->progress = start_delayed_progress(
|
||||||
|
the_repository,
|
||||||
_("Finding extra edges in commit graph"),
|
_("Finding extra edges in commit graph"),
|
||||||
ctx->oids.nr);
|
ctx->oids.nr);
|
||||||
oid_array_sort(&ctx->oids);
|
oid_array_sort(&ctx->oids);
|
||||||
@@ -2136,6 +2146,7 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx)
|
|||||||
get_num_chunks(cf)),
|
get_num_chunks(cf)),
|
||||||
get_num_chunks(cf));
|
get_num_chunks(cf));
|
||||||
ctx->progress = start_delayed_progress(
|
ctx->progress = start_delayed_progress(
|
||||||
|
the_repository,
|
||||||
progress_title.buf,
|
progress_title.buf,
|
||||||
st_mult(get_num_chunks(cf), ctx->commits.nr));
|
st_mult(get_num_chunks(cf), ctx->commits.nr));
|
||||||
}
|
}
|
||||||
@@ -2348,6 +2359,7 @@ static void sort_and_scan_merged_commits(struct write_commit_graph_context *ctx)
|
|||||||
|
|
||||||
if (ctx->report_progress)
|
if (ctx->report_progress)
|
||||||
ctx->progress = start_delayed_progress(
|
ctx->progress = start_delayed_progress(
|
||||||
|
the_repository,
|
||||||
_("Scanning merged commits"),
|
_("Scanning merged commits"),
|
||||||
ctx->commits.nr);
|
ctx->commits.nr);
|
||||||
|
|
||||||
@@ -2392,7 +2404,8 @@ static void merge_commit_graphs(struct write_commit_graph_context *ctx)
|
|||||||
current_graph_number--;
|
current_graph_number--;
|
||||||
|
|
||||||
if (ctx->report_progress)
|
if (ctx->report_progress)
|
||||||
ctx->progress = start_delayed_progress(_("Merging commit-graph"), 0);
|
ctx->progress = start_delayed_progress(the_repository,
|
||||||
|
_("Merging commit-graph"), 0);
|
||||||
|
|
||||||
merge_commit_graph(ctx, g);
|
merge_commit_graph(ctx, g);
|
||||||
stop_progress(&ctx->progress);
|
stop_progress(&ctx->progress);
|
||||||
@@ -2874,7 +2887,8 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g, int flags)
|
|||||||
if (!(flags & COMMIT_GRAPH_VERIFY_SHALLOW))
|
if (!(flags & COMMIT_GRAPH_VERIFY_SHALLOW))
|
||||||
total += g->num_commits_in_base;
|
total += g->num_commits_in_base;
|
||||||
|
|
||||||
progress = start_progress(_("Verifying commits in commit graph"),
|
progress = start_progress(the_repository,
|
||||||
|
_("Verifying commits in commit graph"),
|
||||||
total);
|
total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
34
credential.c
34
credential.c
@@ -1,4 +1,3 @@
|
|||||||
#define USE_THE_REPOSITORY_VARIABLE
|
|
||||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||||
|
|
||||||
#include "git-compat-util.h"
|
#include "git-compat-util.h"
|
||||||
@@ -170,7 +169,7 @@ static int match_partial_url(const char *url, void *cb)
|
|||||||
return matches;
|
return matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void credential_apply_config(struct credential *c)
|
static void credential_apply_config(struct repository *r, struct credential *c)
|
||||||
{
|
{
|
||||||
char *normalized_url;
|
char *normalized_url;
|
||||||
struct urlmatch_config config = URLMATCH_CONFIG_INIT;
|
struct urlmatch_config config = URLMATCH_CONFIG_INIT;
|
||||||
@@ -195,7 +194,7 @@ static void credential_apply_config(struct credential *c)
|
|||||||
credential_format(c, &url);
|
credential_format(c, &url);
|
||||||
normalized_url = url_normalize(url.buf, &config.url);
|
normalized_url = url_normalize(url.buf, &config.url);
|
||||||
|
|
||||||
git_config(urlmatch_config_entry, &config);
|
repo_config(r, urlmatch_config_entry, &config);
|
||||||
string_list_clear(&config.vars, 1);
|
string_list_clear(&config.vars, 1);
|
||||||
free(normalized_url);
|
free(normalized_url);
|
||||||
urlmatch_config_release(&config);
|
urlmatch_config_release(&config);
|
||||||
@@ -262,34 +261,34 @@ static char *credential_ask_one(const char *what, struct credential *c,
|
|||||||
return xstrdup(r);
|
return xstrdup(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int credential_getpass(struct credential *c)
|
static int credential_getpass(struct repository *r, struct credential *c)
|
||||||
{
|
{
|
||||||
int interactive;
|
int interactive;
|
||||||
char *value;
|
char *value;
|
||||||
if (!git_config_get_maybe_bool("credential.interactive", &interactive) &&
|
if (!repo_config_get_maybe_bool(r, "credential.interactive", &interactive) &&
|
||||||
!interactive) {
|
!interactive) {
|
||||||
trace2_data_intmax("credential", the_repository,
|
trace2_data_intmax("credential", r,
|
||||||
"interactive/skipped", 1);
|
"interactive/skipped", 1);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!git_config_get_string("credential.interactive", &value)) {
|
if (!repo_config_get_string(r, "credential.interactive", &value)) {
|
||||||
int same = !strcmp(value, "never");
|
int same = !strcmp(value, "never");
|
||||||
free(value);
|
free(value);
|
||||||
if (same) {
|
if (same) {
|
||||||
trace2_data_intmax("credential", the_repository,
|
trace2_data_intmax("credential", r,
|
||||||
"interactive/skipped", 1);
|
"interactive/skipped", 1);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
trace2_region_enter("credential", "interactive", the_repository);
|
trace2_region_enter("credential", "interactive", r);
|
||||||
if (!c->username)
|
if (!c->username)
|
||||||
c->username = credential_ask_one("Username", c,
|
c->username = credential_ask_one("Username", c,
|
||||||
PROMPT_ASKPASS|PROMPT_ECHO);
|
PROMPT_ASKPASS|PROMPT_ECHO);
|
||||||
if (!c->password)
|
if (!c->password)
|
||||||
c->password = credential_ask_one("Password", c,
|
c->password = credential_ask_one("Password", c,
|
||||||
PROMPT_ASKPASS);
|
PROMPT_ASKPASS);
|
||||||
trace2_region_leave("credential", "interactive", the_repository);
|
trace2_region_leave("credential", "interactive", r);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -502,7 +501,8 @@ static int credential_do(struct credential *c, const char *helper,
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
void credential_fill(struct credential *c, int all_capabilities)
|
void credential_fill(struct repository *r,
|
||||||
|
struct credential *c, int all_capabilities)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -512,7 +512,7 @@ void credential_fill(struct credential *c, int all_capabilities)
|
|||||||
credential_next_state(c);
|
credential_next_state(c);
|
||||||
c->multistage = 0;
|
c->multistage = 0;
|
||||||
|
|
||||||
credential_apply_config(c);
|
credential_apply_config(r, c);
|
||||||
if (all_capabilities)
|
if (all_capabilities)
|
||||||
credential_set_all_capabilities(c, CREDENTIAL_OP_INITIAL);
|
credential_set_all_capabilities(c, CREDENTIAL_OP_INITIAL);
|
||||||
|
|
||||||
@@ -539,12 +539,12 @@ void credential_fill(struct credential *c, int all_capabilities)
|
|||||||
c->helpers.items[i].string);
|
c->helpers.items[i].string);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (credential_getpass(c) ||
|
if (credential_getpass(r, c) ||
|
||||||
(!c->username && !c->password && !c->credential))
|
(!c->username && !c->password && !c->credential))
|
||||||
die("unable to get password from user");
|
die("unable to get password from user");
|
||||||
}
|
}
|
||||||
|
|
||||||
void credential_approve(struct credential *c)
|
void credential_approve(struct repository *r, struct credential *c)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -555,20 +555,20 @@ void credential_approve(struct credential *c)
|
|||||||
|
|
||||||
credential_next_state(c);
|
credential_next_state(c);
|
||||||
|
|
||||||
credential_apply_config(c);
|
credential_apply_config(r, c);
|
||||||
|
|
||||||
for (i = 0; i < c->helpers.nr; i++)
|
for (i = 0; i < c->helpers.nr; i++)
|
||||||
credential_do(c, c->helpers.items[i].string, "store");
|
credential_do(c, c->helpers.items[i].string, "store");
|
||||||
c->approved = 1;
|
c->approved = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void credential_reject(struct credential *c)
|
void credential_reject(struct repository *r, struct credential *c)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
credential_next_state(c);
|
credential_next_state(c);
|
||||||
|
|
||||||
credential_apply_config(c);
|
credential_apply_config(r, c);
|
||||||
|
|
||||||
for (i = 0; i < c->helpers.nr; i++)
|
for (i = 0; i < c->helpers.nr; i++)
|
||||||
credential_do(c, c->helpers.items[i].string, "erase");
|
credential_do(c, c->helpers.items[i].string, "erase");
|
||||||
|
|||||||
11
credential.h
11
credential.h
@@ -4,6 +4,8 @@
|
|||||||
#include "string-list.h"
|
#include "string-list.h"
|
||||||
#include "strvec.h"
|
#include "strvec.h"
|
||||||
|
|
||||||
|
struct repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The credentials API provides an abstracted way of gathering
|
* The credentials API provides an abstracted way of gathering
|
||||||
* authentication credentials from the user.
|
* authentication credentials from the user.
|
||||||
@@ -65,7 +67,7 @@
|
|||||||
* // Fill in the username and password fields by contacting
|
* // Fill in the username and password fields by contacting
|
||||||
* // helpers and/or asking the user. The function will die if it
|
* // helpers and/or asking the user. The function will die if it
|
||||||
* // fails.
|
* // fails.
|
||||||
* credential_fill(&c);
|
* credential_fill(repo, &c);
|
||||||
*
|
*
|
||||||
* // Otherwise, we have a username and password. Try to use it.
|
* // Otherwise, we have a username and password. Try to use it.
|
||||||
*
|
*
|
||||||
@@ -222,7 +224,8 @@ void credential_clear(struct credential *);
|
|||||||
* If all_capabilities is set, this is an internal user that is prepared
|
* If all_capabilities is set, this is an internal user that is prepared
|
||||||
* to deal with all known capabilities, and we should advertise that fact.
|
* to deal with all known capabilities, and we should advertise that fact.
|
||||||
*/
|
*/
|
||||||
void credential_fill(struct credential *, int all_capabilities);
|
void credential_fill(struct repository *, struct credential *,
|
||||||
|
int all_capabilities);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inform the credential subsystem that the provided credentials
|
* Inform the credential subsystem that the provided credentials
|
||||||
@@ -231,7 +234,7 @@ void credential_fill(struct credential *, int all_capabilities);
|
|||||||
* that they may store the result to be used again. Any errors
|
* that they may store the result to be used again. Any errors
|
||||||
* from helpers are ignored.
|
* from helpers are ignored.
|
||||||
*/
|
*/
|
||||||
void credential_approve(struct credential *);
|
void credential_approve(struct repository *, struct credential *);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inform the credential subsystem that the provided credentials
|
* Inform the credential subsystem that the provided credentials
|
||||||
@@ -243,7 +246,7 @@ void credential_approve(struct credential *);
|
|||||||
* for another call to `credential_fill`). Any errors from helpers
|
* for another call to `credential_fill`). Any errors from helpers
|
||||||
* are ignored.
|
* are ignored.
|
||||||
*/
|
*/
|
||||||
void credential_reject(struct credential *);
|
void credential_reject(struct repository *, struct credential *);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable all of the supported credential flags in this credential.
|
* Enable all of the supported credential flags in this credential.
|
||||||
|
|||||||
@@ -267,7 +267,8 @@ void resolve_tree_islands(struct repository *r,
|
|||||||
QSORT(todo, nr, tree_depth_compare);
|
QSORT(todo, nr, tree_depth_compare);
|
||||||
|
|
||||||
if (progress)
|
if (progress)
|
||||||
progress_state = start_progress(_("Propagating island marks"), nr);
|
progress_state = start_progress(the_repository,
|
||||||
|
_("Propagating island marks"), nr);
|
||||||
|
|
||||||
for (i = 0; i < nr; i++) {
|
for (i = 0; i < nr; i++) {
|
||||||
struct object_entry *ent = todo[i].entry;
|
struct object_entry *ent = todo[i].entry;
|
||||||
|
|||||||
15
diagnose.c
15
diagnose.c
@@ -1,5 +1,3 @@
|
|||||||
#define USE_THE_REPOSITORY_VARIABLE
|
|
||||||
|
|
||||||
#include "git-compat-util.h"
|
#include "git-compat-util.h"
|
||||||
#include "diagnose.h"
|
#include "diagnose.h"
|
||||||
#include "compat/disk.h"
|
#include "compat/disk.h"
|
||||||
@@ -12,6 +10,7 @@
|
|||||||
#include "object-store-ll.h"
|
#include "object-store-ll.h"
|
||||||
#include "packfile.h"
|
#include "packfile.h"
|
||||||
#include "parse-options.h"
|
#include "parse-options.h"
|
||||||
|
#include "repository.h"
|
||||||
#include "write-or-die.h"
|
#include "write-or-die.h"
|
||||||
|
|
||||||
struct archive_dir {
|
struct archive_dir {
|
||||||
@@ -179,7 +178,9 @@ static int add_directory_to_archiver(struct strvec *archiver_args,
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
int create_diagnostics_archive(struct strbuf *zip_path, enum diagnose_mode mode)
|
int create_diagnostics_archive(struct repository *r,
|
||||||
|
struct strbuf *zip_path,
|
||||||
|
enum diagnose_mode mode)
|
||||||
{
|
{
|
||||||
struct strvec archiver_args = STRVEC_INIT;
|
struct strvec archiver_args = STRVEC_INIT;
|
||||||
char **argv_copy = NULL;
|
char **argv_copy = NULL;
|
||||||
@@ -218,7 +219,7 @@ int create_diagnostics_archive(struct strbuf *zip_path, enum diagnose_mode mode)
|
|||||||
strbuf_addstr(&buf, "Collecting diagnostic info\n\n");
|
strbuf_addstr(&buf, "Collecting diagnostic info\n\n");
|
||||||
get_version_info(&buf, 1);
|
get_version_info(&buf, 1);
|
||||||
|
|
||||||
strbuf_addf(&buf, "Repository root: %s\n", the_repository->worktree);
|
strbuf_addf(&buf, "Repository root: %s\n", r->worktree);
|
||||||
get_disk_info(&buf);
|
get_disk_info(&buf);
|
||||||
write_or_die(stdout_fd, buf.buf, buf.len);
|
write_or_die(stdout_fd, buf.buf, buf.len);
|
||||||
strvec_pushf(&archiver_args,
|
strvec_pushf(&archiver_args,
|
||||||
@@ -227,7 +228,7 @@ int create_diagnostics_archive(struct strbuf *zip_path, enum diagnose_mode mode)
|
|||||||
|
|
||||||
strbuf_reset(&buf);
|
strbuf_reset(&buf);
|
||||||
strbuf_addstr(&buf, "--add-virtual-file=packs-local.txt:");
|
strbuf_addstr(&buf, "--add-virtual-file=packs-local.txt:");
|
||||||
dir_file_stats(the_repository->objects->odb, &buf);
|
dir_file_stats(r->objects->odb, &buf);
|
||||||
foreach_alt_odb(dir_file_stats, &buf);
|
foreach_alt_odb(dir_file_stats, &buf);
|
||||||
strvec_push(&archiver_args, buf.buf);
|
strvec_push(&archiver_args, buf.buf);
|
||||||
|
|
||||||
@@ -250,13 +251,13 @@ int create_diagnostics_archive(struct strbuf *zip_path, enum diagnose_mode mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
strvec_pushl(&archiver_args, "--prefix=",
|
strvec_pushl(&archiver_args, "--prefix=",
|
||||||
oid_to_hex(the_hash_algo->empty_tree), "--", NULL);
|
oid_to_hex(r->hash_algo->empty_tree), "--", NULL);
|
||||||
|
|
||||||
/* `write_archive()` modifies the `argv` passed to it. Let it. */
|
/* `write_archive()` modifies the `argv` passed to it. Let it. */
|
||||||
argv_copy = xmemdupz(archiver_args.v,
|
argv_copy = xmemdupz(archiver_args.v,
|
||||||
sizeof(char *) * archiver_args.nr);
|
sizeof(char *) * archiver_args.nr);
|
||||||
res = write_archive(archiver_args.nr, (const char **)argv_copy, NULL,
|
res = write_archive(archiver_args.nr, (const char **)argv_copy, NULL,
|
||||||
the_repository, NULL, 0);
|
r, NULL, 0);
|
||||||
if (res) {
|
if (res) {
|
||||||
error(_("failed to write archive"));
|
error(_("failed to write archive"));
|
||||||
goto diagnose_cleanup;
|
goto diagnose_cleanup;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "strbuf.h"
|
#include "strbuf.h"
|
||||||
|
|
||||||
struct option;
|
struct option;
|
||||||
|
struct repository;
|
||||||
|
|
||||||
enum diagnose_mode {
|
enum diagnose_mode {
|
||||||
DIAGNOSE_NONE,
|
DIAGNOSE_NONE,
|
||||||
@@ -13,6 +14,8 @@ enum diagnose_mode {
|
|||||||
|
|
||||||
int option_parse_diagnose(const struct option *opt, const char *arg, int unset);
|
int option_parse_diagnose(const struct option *opt, const char *arg, int unset);
|
||||||
|
|
||||||
int create_diagnostics_archive(struct strbuf *zip_path, enum diagnose_mode mode);
|
int create_diagnostics_archive(struct repository *r,
|
||||||
|
struct strbuf *zip_path,
|
||||||
|
enum diagnose_mode mode);
|
||||||
|
|
||||||
#endif /* DIAGNOSE_H */
|
#endif /* DIAGNOSE_H */
|
||||||
|
|||||||
4
diff.c
4
diff.c
@@ -7386,6 +7386,6 @@ void setup_diff_pager(struct diff_options *opt)
|
|||||||
* --exit-code" in hooks and other scripts, we do not do so.
|
* --exit-code" in hooks and other scripts, we do not do so.
|
||||||
*/
|
*/
|
||||||
if (!opt->flags.exit_with_status &&
|
if (!opt->flags.exit_with_status &&
|
||||||
check_pager_config("diff") != 0)
|
check_pager_config(the_repository, "diff") != 0)
|
||||||
setup_pager();
|
setup_pager(the_repository);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1567,6 +1567,7 @@ void diffcore_rename_extended(struct diff_options *options,
|
|||||||
trace2_region_enter("diff", "inexact renames", options->repo);
|
trace2_region_enter("diff", "inexact renames", options->repo);
|
||||||
if (options->show_rename_progress) {
|
if (options->show_rename_progress) {
|
||||||
progress = start_delayed_progress(
|
progress = start_delayed_progress(
|
||||||
|
the_repository,
|
||||||
_("Performing inexact rename detection"),
|
_("Performing inexact rename detection"),
|
||||||
(uint64_t)num_destinations * (uint64_t)num_sources);
|
(uint64_t)num_destinations * (uint64_t)num_sources);
|
||||||
}
|
}
|
||||||
|
|||||||
4
entry.c
4
entry.c
@@ -188,7 +188,9 @@ int finish_delayed_checkout(struct checkout *state, int show_progress)
|
|||||||
|
|
||||||
dco->state = CE_RETRY;
|
dco->state = CE_RETRY;
|
||||||
if (show_progress)
|
if (show_progress)
|
||||||
progress = start_delayed_progress(_("Filtering content"), dco->paths.nr);
|
progress = start_delayed_progress(the_repository,
|
||||||
|
_("Filtering content"),
|
||||||
|
dco->paths.nr);
|
||||||
while (dco->filters.nr > 0) {
|
while (dco->filters.nr > 0) {
|
||||||
for_each_string_list_item(filter, &dco->filters) {
|
for_each_string_list_item(filter, &dco->filters) {
|
||||||
struct string_list available_paths = STRING_LIST_INIT_DUP;
|
struct string_list available_paths = STRING_LIST_INIT_DUP;
|
||||||
|
|||||||
10
git.c
10
git.c
@@ -125,7 +125,7 @@ static void commit_pager_choice(void)
|
|||||||
setenv("GIT_PAGER", "cat", 1);
|
setenv("GIT_PAGER", "cat", 1);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
setup_pager();
|
setup_pager(the_repository);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -136,7 +136,7 @@ void setup_auto_pager(const char *cmd, int def)
|
|||||||
{
|
{
|
||||||
if (use_pager != -1 || pager_in_use())
|
if (use_pager != -1 || pager_in_use())
|
||||||
return;
|
return;
|
||||||
use_pager = check_pager_config(cmd);
|
use_pager = check_pager_config(the_repository, cmd);
|
||||||
if (use_pager == -1)
|
if (use_pager == -1)
|
||||||
use_pager = def;
|
use_pager = def;
|
||||||
commit_pager_choice();
|
commit_pager_choice();
|
||||||
@@ -462,12 +462,12 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv, struct
|
|||||||
precompose_argv_prefix(argc, argv, NULL);
|
precompose_argv_prefix(argc, argv, NULL);
|
||||||
if (use_pager == -1 && run_setup &&
|
if (use_pager == -1 && run_setup &&
|
||||||
!(p->option & DELAY_PAGER_CONFIG))
|
!(p->option & DELAY_PAGER_CONFIG))
|
||||||
use_pager = check_pager_config(p->cmd);
|
use_pager = check_pager_config(the_repository, p->cmd);
|
||||||
if (use_pager == -1 && p->option & USE_PAGER)
|
if (use_pager == -1 && p->option & USE_PAGER)
|
||||||
use_pager = 1;
|
use_pager = 1;
|
||||||
if (run_setup && startup_info->have_repository)
|
if (run_setup && startup_info->have_repository)
|
||||||
/* get_git_dir() may set up repo, avoid that */
|
/* get_git_dir() may set up repo, avoid that */
|
||||||
trace_repo_setup();
|
trace_repo_setup(the_repository);
|
||||||
commit_pager_choice();
|
commit_pager_choice();
|
||||||
|
|
||||||
if (!help && p->option & NEED_WORK_TREE)
|
if (!help && p->option & NEED_WORK_TREE)
|
||||||
@@ -750,7 +750,7 @@ static void execv_dashed_external(const char **argv)
|
|||||||
int status;
|
int status;
|
||||||
|
|
||||||
if (use_pager == -1 && !is_builtin(argv[0]))
|
if (use_pager == -1 && !is_builtin(argv[0]))
|
||||||
use_pager = check_pager_config(argv[0]);
|
use_pager = check_pager_config(the_repository, argv[0]);
|
||||||
commit_pager_choice();
|
commit_pager_choice();
|
||||||
|
|
||||||
strvec_pushf(&cmd.args, "git-%s", argv[0]);
|
strvec_pushf(&cmd.args, "git-%s", argv[0]);
|
||||||
|
|||||||
3
graph.c
3
graph.c
@@ -1,4 +1,3 @@
|
|||||||
#define USE_THE_REPOSITORY_VARIABLE
|
|
||||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||||
|
|
||||||
#include "git-compat-util.h"
|
#include "git-compat-util.h"
|
||||||
@@ -351,7 +350,7 @@ struct git_graph *graph_init(struct rev_info *opt)
|
|||||||
|
|
||||||
if (!column_colors) {
|
if (!column_colors) {
|
||||||
char *string;
|
char *string;
|
||||||
if (git_config_get_string("log.graphcolors", &string)) {
|
if (repo_config_get_string(opt->repo, "log.graphcolors", &string)) {
|
||||||
/* not configured -- use default */
|
/* not configured -- use default */
|
||||||
graph_set_column_colors(column_colors_ansi,
|
graph_set_column_colors(column_colors_ansi,
|
||||||
column_colors_ansi_max);
|
column_colors_ansi_max);
|
||||||
|
|||||||
24
http.c
24
http.c
@@ -609,7 +609,7 @@ static void init_curl_http_auth(CURL *result)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
credential_fill(&http_auth, 1);
|
credential_fill(the_repository, &http_auth, 1);
|
||||||
|
|
||||||
if (http_auth.password) {
|
if (http_auth.password) {
|
||||||
if (always_auth_proactively()) {
|
if (always_auth_proactively()) {
|
||||||
@@ -652,7 +652,7 @@ static void init_curl_proxy_auth(CURL *result)
|
|||||||
{
|
{
|
||||||
if (proxy_auth.username) {
|
if (proxy_auth.username) {
|
||||||
if (!proxy_auth.password && !proxy_auth.credential)
|
if (!proxy_auth.password && !proxy_auth.credential)
|
||||||
credential_fill(&proxy_auth, 1);
|
credential_fill(the_repository, &proxy_auth, 1);
|
||||||
set_proxyauth_name_password(result);
|
set_proxyauth_name_password(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -686,7 +686,7 @@ static int has_cert_password(void)
|
|||||||
cert_auth.host = xstrdup("");
|
cert_auth.host = xstrdup("");
|
||||||
cert_auth.username = xstrdup("");
|
cert_auth.username = xstrdup("");
|
||||||
cert_auth.path = xstrdup(ssl_cert);
|
cert_auth.path = xstrdup(ssl_cert);
|
||||||
credential_fill(&cert_auth, 0);
|
credential_fill(the_repository, &cert_auth, 0);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -700,7 +700,7 @@ static int has_proxy_cert_password(void)
|
|||||||
proxy_cert_auth.host = xstrdup("");
|
proxy_cert_auth.host = xstrdup("");
|
||||||
proxy_cert_auth.username = xstrdup("");
|
proxy_cert_auth.username = xstrdup("");
|
||||||
proxy_cert_auth.path = xstrdup(http_proxy_ssl_cert);
|
proxy_cert_auth.path = xstrdup(http_proxy_ssl_cert);
|
||||||
credential_fill(&proxy_cert_auth, 0);
|
credential_fill(the_repository, &proxy_cert_auth, 0);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1784,9 +1784,9 @@ static int handle_curl_result(struct slot_results *results)
|
|||||||
curl_errorstr, sizeof(curl_errorstr));
|
curl_errorstr, sizeof(curl_errorstr));
|
||||||
|
|
||||||
if (results->curl_result == CURLE_OK) {
|
if (results->curl_result == CURLE_OK) {
|
||||||
credential_approve(&http_auth);
|
credential_approve(the_repository, &http_auth);
|
||||||
credential_approve(&proxy_auth);
|
credential_approve(the_repository, &proxy_auth);
|
||||||
credential_approve(&cert_auth);
|
credential_approve(the_repository, &cert_auth);
|
||||||
return HTTP_OK;
|
return HTTP_OK;
|
||||||
} else if (results->curl_result == CURLE_SSL_CERTPROBLEM) {
|
} else if (results->curl_result == CURLE_SSL_CERTPROBLEM) {
|
||||||
/*
|
/*
|
||||||
@@ -1795,7 +1795,7 @@ static int handle_curl_result(struct slot_results *results)
|
|||||||
* with the certificate. So we reject the credential to
|
* with the certificate. So we reject the credential to
|
||||||
* avoid caching or saving a bad password.
|
* avoid caching or saving a bad password.
|
||||||
*/
|
*/
|
||||||
credential_reject(&cert_auth);
|
credential_reject(the_repository, &cert_auth);
|
||||||
return HTTP_NOAUTH;
|
return HTTP_NOAUTH;
|
||||||
} else if (results->curl_result == CURLE_SSL_PINNEDPUBKEYNOTMATCH) {
|
} else if (results->curl_result == CURLE_SSL_PINNEDPUBKEYNOTMATCH) {
|
||||||
return HTTP_NOMATCHPUBLICKEY;
|
return HTTP_NOMATCHPUBLICKEY;
|
||||||
@@ -1808,7 +1808,7 @@ static int handle_curl_result(struct slot_results *results)
|
|||||||
credential_clear_secrets(&http_auth);
|
credential_clear_secrets(&http_auth);
|
||||||
return HTTP_REAUTH;
|
return HTTP_REAUTH;
|
||||||
}
|
}
|
||||||
credential_reject(&http_auth);
|
credential_reject(the_repository, &http_auth);
|
||||||
if (always_auth_proactively())
|
if (always_auth_proactively())
|
||||||
http_proactive_auth = PROACTIVE_AUTH_NONE;
|
http_proactive_auth = PROACTIVE_AUTH_NONE;
|
||||||
return HTTP_NOAUTH;
|
return HTTP_NOAUTH;
|
||||||
@@ -1822,7 +1822,7 @@ static int handle_curl_result(struct slot_results *results)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (results->http_connectcode == 407)
|
if (results->http_connectcode == 407)
|
||||||
credential_reject(&proxy_auth);
|
credential_reject(the_repository, &proxy_auth);
|
||||||
if (!curl_errorstr[0])
|
if (!curl_errorstr[0])
|
||||||
strlcpy(curl_errorstr,
|
strlcpy(curl_errorstr,
|
||||||
curl_easy_strerror(results->curl_result),
|
curl_easy_strerror(results->curl_result),
|
||||||
@@ -2210,7 +2210,7 @@ static int http_request_reauth(const char *url,
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (always_auth_proactively())
|
if (always_auth_proactively())
|
||||||
credential_fill(&http_auth, 1);
|
credential_fill(the_repository, &http_auth, 1);
|
||||||
|
|
||||||
ret = http_request(url, result, target, options);
|
ret = http_request(url, result, target, options);
|
||||||
|
|
||||||
@@ -2251,7 +2251,7 @@ static int http_request_reauth(const char *url,
|
|||||||
BUG("Unknown http_request target");
|
BUG("Unknown http_request target");
|
||||||
}
|
}
|
||||||
|
|
||||||
credential_fill(&http_auth, 1);
|
credential_fill(the_repository, &http_auth, 1);
|
||||||
|
|
||||||
ret = http_request(url, result, target, options);
|
ret = http_request(url, result, target, options);
|
||||||
}
|
}
|
||||||
|
|||||||
10
imap-send.c
10
imap-send.c
@@ -922,7 +922,7 @@ static void server_fill_credential(struct imap_server_conf *srvc, struct credent
|
|||||||
cred->username = xstrdup_or_null(srvc->user);
|
cred->username = xstrdup_or_null(srvc->user);
|
||||||
cred->password = xstrdup_or_null(srvc->pass);
|
cred->password = xstrdup_or_null(srvc->pass);
|
||||||
|
|
||||||
credential_fill(cred, 1);
|
credential_fill(the_repository, cred, 1);
|
||||||
|
|
||||||
if (!srvc->user)
|
if (!srvc->user)
|
||||||
srvc->user = xstrdup(cred->username);
|
srvc->user = xstrdup(cred->username);
|
||||||
@@ -1123,7 +1123,7 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc, const c
|
|||||||
} /* !preauth */
|
} /* !preauth */
|
||||||
|
|
||||||
if (cred.username)
|
if (cred.username)
|
||||||
credential_approve(&cred);
|
credential_approve(the_repository, &cred);
|
||||||
credential_clear(&cred);
|
credential_clear(&cred);
|
||||||
|
|
||||||
/* check the target mailbox exists */
|
/* check the target mailbox exists */
|
||||||
@@ -1150,7 +1150,7 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc, const c
|
|||||||
|
|
||||||
bail:
|
bail:
|
||||||
if (cred.username)
|
if (cred.username)
|
||||||
credential_reject(&cred);
|
credential_reject(the_repository, &cred);
|
||||||
credential_clear(&cred);
|
credential_clear(&cred);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
@@ -1492,9 +1492,9 @@ static int curl_append_msgs_to_imap(struct imap_server_conf *server,
|
|||||||
|
|
||||||
if (cred.username) {
|
if (cred.username) {
|
||||||
if (res == CURLE_OK)
|
if (res == CURLE_OK)
|
||||||
credential_approve(&cred);
|
credential_approve(the_repository, &cred);
|
||||||
else if (res == CURLE_LOGIN_DENIED)
|
else if (res == CURLE_LOGIN_DENIED)
|
||||||
credential_reject(&cred);
|
credential_reject(the_repository, &cred);
|
||||||
}
|
}
|
||||||
|
|
||||||
credential_clear(&cred);
|
credential_clear(&cred);
|
||||||
|
|||||||
@@ -1042,7 +1042,7 @@ static int do_remerge_diff(struct rev_info *opt,
|
|||||||
* into the alternative object store list as the primary.
|
* into the alternative object store list as the primary.
|
||||||
*/
|
*/
|
||||||
if (opt->remerge_diff && !opt->remerge_objdir) {
|
if (opt->remerge_diff && !opt->remerge_objdir) {
|
||||||
opt->remerge_objdir = tmp_objdir_create("remerge-diff");
|
opt->remerge_objdir = tmp_objdir_create(the_repository, "remerge-diff");
|
||||||
if (!opt->remerge_objdir)
|
if (!opt->remerge_objdir)
|
||||||
return error(_("unable to create temporary object directory"));
|
return error(_("unable to create temporary object directory"));
|
||||||
tmp_objdir_replace_primary_odb(opt->remerge_objdir, 1);
|
tmp_objdir_replace_primary_odb(opt->remerge_objdir, 1);
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#define USE_THE_REPOSITORY_VARIABLE
|
|
||||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||||
|
|
||||||
#include "git-compat-util.h"
|
#include "git-compat-util.h"
|
||||||
@@ -1269,7 +1268,7 @@ static int git_mailinfo_config(const char *var, const char *value,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_mailinfo(struct mailinfo *mi)
|
void setup_mailinfo(struct repository *r, struct mailinfo *mi)
|
||||||
{
|
{
|
||||||
memset(mi, 0, sizeof(*mi));
|
memset(mi, 0, sizeof(*mi));
|
||||||
strbuf_init(&mi->name, 0);
|
strbuf_init(&mi->name, 0);
|
||||||
@@ -1281,7 +1280,7 @@ void setup_mailinfo(struct mailinfo *mi)
|
|||||||
mi->header_stage = 1;
|
mi->header_stage = 1;
|
||||||
mi->use_inbody_headers = 1;
|
mi->use_inbody_headers = 1;
|
||||||
mi->content_top = mi->content;
|
mi->content_top = mi->content;
|
||||||
git_config(git_mailinfo_config, mi);
|
repo_config(r, git_mailinfo_config, mi);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_mailinfo(struct mailinfo *mi)
|
void clear_mailinfo(struct mailinfo *mi)
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#define MAX_BOUNDARIES 5
|
#define MAX_BOUNDARIES 5
|
||||||
|
|
||||||
|
struct repository;
|
||||||
|
|
||||||
enum quoted_cr_action {
|
enum quoted_cr_action {
|
||||||
quoted_cr_unset = -1,
|
quoted_cr_unset = -1,
|
||||||
quoted_cr_nowarn,
|
quoted_cr_nowarn,
|
||||||
@@ -49,7 +51,7 @@ struct mailinfo {
|
|||||||
};
|
};
|
||||||
|
|
||||||
int mailinfo_parse_quoted_cr_action(const char *actionstr, int *action);
|
int mailinfo_parse_quoted_cr_action(const char *actionstr, int *action);
|
||||||
void setup_mailinfo(struct mailinfo *);
|
void setup_mailinfo(struct repository *r, struct mailinfo *);
|
||||||
int mailinfo(struct mailinfo *, const char *msg, const char *patch);
|
int mailinfo(struct mailinfo *, const char *msg, const char *patch);
|
||||||
void clear_mailinfo(struct mailinfo *);
|
void clear_mailinfo(struct mailinfo *);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#define USE_THE_REPOSITORY_VARIABLE
|
|
||||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||||
|
|
||||||
#include "git-compat-util.h"
|
#include "git-compat-util.h"
|
||||||
@@ -8,6 +7,7 @@
|
|||||||
#include "tree.h"
|
#include "tree.h"
|
||||||
#include "tree-walk.h"
|
#include "tree-walk.h"
|
||||||
#include "object-store-ll.h"
|
#include "object-store-ll.h"
|
||||||
|
#include "repository.h"
|
||||||
|
|
||||||
static int score_missing(unsigned mode)
|
static int score_missing(unsigned mode)
|
||||||
{
|
{
|
||||||
@@ -54,14 +54,15 @@ static int score_matches(unsigned mode1, unsigned mode2)
|
|||||||
return score;
|
return score;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *fill_tree_desc_strict(struct tree_desc *desc,
|
static void *fill_tree_desc_strict(struct repository *r,
|
||||||
|
struct tree_desc *desc,
|
||||||
const struct object_id *hash)
|
const struct object_id *hash)
|
||||||
{
|
{
|
||||||
void *buffer;
|
void *buffer;
|
||||||
enum object_type type;
|
enum object_type type;
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
|
|
||||||
buffer = repo_read_object_file(the_repository, hash, &type, &size);
|
buffer = repo_read_object_file(r, hash, &type, &size);
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
die("unable to read tree (%s)", oid_to_hex(hash));
|
die("unable to read tree (%s)", oid_to_hex(hash));
|
||||||
if (type != OBJ_TREE)
|
if (type != OBJ_TREE)
|
||||||
@@ -80,12 +81,13 @@ static int base_name_entries_compare(const struct name_entry *a,
|
|||||||
/*
|
/*
|
||||||
* Inspect two trees, and give a score that tells how similar they are.
|
* Inspect two trees, and give a score that tells how similar they are.
|
||||||
*/
|
*/
|
||||||
static int score_trees(const struct object_id *hash1, const struct object_id *hash2)
|
static int score_trees(struct repository *r,
|
||||||
|
const struct object_id *hash1, const struct object_id *hash2)
|
||||||
{
|
{
|
||||||
struct tree_desc one;
|
struct tree_desc one;
|
||||||
struct tree_desc two;
|
struct tree_desc two;
|
||||||
void *one_buf = fill_tree_desc_strict(&one, hash1);
|
void *one_buf = fill_tree_desc_strict(r, &one, hash1);
|
||||||
void *two_buf = fill_tree_desc_strict(&two, hash2);
|
void *two_buf = fill_tree_desc_strict(r, &two, hash2);
|
||||||
int score = 0;
|
int score = 0;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@@ -133,7 +135,8 @@ static int score_trees(const struct object_id *hash1, const struct object_id *ha
|
|||||||
/*
|
/*
|
||||||
* Match one itself and its subtrees with two and pick the best match.
|
* Match one itself and its subtrees with two and pick the best match.
|
||||||
*/
|
*/
|
||||||
static void match_trees(const struct object_id *hash1,
|
static void match_trees(struct repository *r,
|
||||||
|
const struct object_id *hash1,
|
||||||
const struct object_id *hash2,
|
const struct object_id *hash2,
|
||||||
int *best_score,
|
int *best_score,
|
||||||
char **best_match,
|
char **best_match,
|
||||||
@@ -141,7 +144,7 @@ static void match_trees(const struct object_id *hash1,
|
|||||||
int recurse_limit)
|
int recurse_limit)
|
||||||
{
|
{
|
||||||
struct tree_desc one;
|
struct tree_desc one;
|
||||||
void *one_buf = fill_tree_desc_strict(&one, hash1);
|
void *one_buf = fill_tree_desc_strict(r, &one, hash1);
|
||||||
|
|
||||||
while (one.size) {
|
while (one.size) {
|
||||||
const char *path;
|
const char *path;
|
||||||
@@ -152,7 +155,7 @@ static void match_trees(const struct object_id *hash1,
|
|||||||
elem = tree_entry_extract(&one, &path, &mode);
|
elem = tree_entry_extract(&one, &path, &mode);
|
||||||
if (!S_ISDIR(mode))
|
if (!S_ISDIR(mode))
|
||||||
goto next;
|
goto next;
|
||||||
score = score_trees(elem, hash2);
|
score = score_trees(r, elem, hash2);
|
||||||
if (*best_score < score) {
|
if (*best_score < score) {
|
||||||
free(*best_match);
|
free(*best_match);
|
||||||
*best_match = xstrfmt("%s%s", base, path);
|
*best_match = xstrfmt("%s%s", base, path);
|
||||||
@@ -160,7 +163,7 @@ static void match_trees(const struct object_id *hash1,
|
|||||||
}
|
}
|
||||||
if (recurse_limit) {
|
if (recurse_limit) {
|
||||||
char *newbase = xstrfmt("%s%s/", base, path);
|
char *newbase = xstrfmt("%s%s/", base, path);
|
||||||
match_trees(elem, hash2, best_score, best_match,
|
match_trees(r, elem, hash2, best_score, best_match,
|
||||||
newbase, recurse_limit - 1);
|
newbase, recurse_limit - 1);
|
||||||
free(newbase);
|
free(newbase);
|
||||||
}
|
}
|
||||||
@@ -175,7 +178,8 @@ static void match_trees(const struct object_id *hash1,
|
|||||||
* A tree "oid1" has a subdirectory at "prefix". Come up with a tree object by
|
* A tree "oid1" has a subdirectory at "prefix". Come up with a tree object by
|
||||||
* replacing it with another tree "oid2".
|
* replacing it with another tree "oid2".
|
||||||
*/
|
*/
|
||||||
static int splice_tree(const struct object_id *oid1, const char *prefix,
|
static int splice_tree(struct repository *r,
|
||||||
|
const struct object_id *oid1, const char *prefix,
|
||||||
const struct object_id *oid2, struct object_id *result)
|
const struct object_id *oid2, struct object_id *result)
|
||||||
{
|
{
|
||||||
char *subpath;
|
char *subpath;
|
||||||
@@ -194,7 +198,7 @@ static int splice_tree(const struct object_id *oid1, const char *prefix,
|
|||||||
if (*subpath)
|
if (*subpath)
|
||||||
subpath++;
|
subpath++;
|
||||||
|
|
||||||
buf = repo_read_object_file(the_repository, oid1, &type, &sz);
|
buf = repo_read_object_file(r, oid1, &type, &sz);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
die("cannot read tree %s", oid_to_hex(oid1));
|
die("cannot read tree %s", oid_to_hex(oid1));
|
||||||
init_tree_desc(&desc, oid1, buf, sz);
|
init_tree_desc(&desc, oid1, buf, sz);
|
||||||
@@ -232,15 +236,15 @@ static int splice_tree(const struct object_id *oid1, const char *prefix,
|
|||||||
oid_to_hex(oid1));
|
oid_to_hex(oid1));
|
||||||
if (*subpath) {
|
if (*subpath) {
|
||||||
struct object_id tree_oid;
|
struct object_id tree_oid;
|
||||||
oidread(&tree_oid, rewrite_here, the_repository->hash_algo);
|
oidread(&tree_oid, rewrite_here, r->hash_algo);
|
||||||
status = splice_tree(&tree_oid, subpath, oid2, &subtree);
|
status = splice_tree(r, &tree_oid, subpath, oid2, &subtree);
|
||||||
if (status)
|
if (status)
|
||||||
return status;
|
return status;
|
||||||
rewrite_with = &subtree;
|
rewrite_with = &subtree;
|
||||||
} else {
|
} else {
|
||||||
rewrite_with = oid2;
|
rewrite_with = oid2;
|
||||||
}
|
}
|
||||||
hashcpy(rewrite_here, rewrite_with->hash, the_repository->hash_algo);
|
hashcpy(rewrite_here, rewrite_with->hash, r->hash_algo);
|
||||||
status = write_object_file(buf, sz, OBJ_TREE, result);
|
status = write_object_file(buf, sz, OBJ_TREE, result);
|
||||||
free(buf);
|
free(buf);
|
||||||
return status;
|
return status;
|
||||||
@@ -271,7 +275,7 @@ void shift_tree(struct repository *r,
|
|||||||
if (!depth_limit)
|
if (!depth_limit)
|
||||||
depth_limit = 2;
|
depth_limit = 2;
|
||||||
|
|
||||||
add_score = del_score = score_trees(hash1, hash2);
|
add_score = del_score = score_trees(r, hash1, hash2);
|
||||||
add_prefix = xcalloc(1, 1);
|
add_prefix = xcalloc(1, 1);
|
||||||
del_prefix = xcalloc(1, 1);
|
del_prefix = xcalloc(1, 1);
|
||||||
|
|
||||||
@@ -279,13 +283,13 @@ void shift_tree(struct repository *r,
|
|||||||
* See if one's subtree resembles two; if so we need to prefix
|
* See if one's subtree resembles two; if so we need to prefix
|
||||||
* two with a few fake trees to match the prefix.
|
* two with a few fake trees to match the prefix.
|
||||||
*/
|
*/
|
||||||
match_trees(hash1, hash2, &add_score, &add_prefix, "", depth_limit);
|
match_trees(r, hash1, hash2, &add_score, &add_prefix, "", depth_limit);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* See if two's subtree resembles one; if so we need to
|
* See if two's subtree resembles one; if so we need to
|
||||||
* pick only subtree of two.
|
* pick only subtree of two.
|
||||||
*/
|
*/
|
||||||
match_trees(hash2, hash1, &del_score, &del_prefix, "", depth_limit);
|
match_trees(r, hash2, hash1, &del_score, &del_prefix, "", depth_limit);
|
||||||
|
|
||||||
/* Assume we do not have to do any shifting */
|
/* Assume we do not have to do any shifting */
|
||||||
oidcpy(shifted, hash2);
|
oidcpy(shifted, hash2);
|
||||||
@@ -306,7 +310,7 @@ void shift_tree(struct repository *r,
|
|||||||
if (!*add_prefix)
|
if (!*add_prefix)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
splice_tree(hash1, add_prefix, hash2, shifted);
|
splice_tree(r, hash1, add_prefix, hash2, shifted);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free(add_prefix);
|
free(add_prefix);
|
||||||
@@ -340,16 +344,16 @@ void shift_tree_by(struct repository *r,
|
|||||||
|
|
||||||
if (candidate == 3) {
|
if (candidate == 3) {
|
||||||
/* Both are plausible -- we need to evaluate the score */
|
/* Both are plausible -- we need to evaluate the score */
|
||||||
int best_score = score_trees(hash1, hash2);
|
int best_score = score_trees(r, hash1, hash2);
|
||||||
int score;
|
int score;
|
||||||
|
|
||||||
candidate = 0;
|
candidate = 0;
|
||||||
score = score_trees(&sub1, hash2);
|
score = score_trees(r, &sub1, hash2);
|
||||||
if (score > best_score) {
|
if (score > best_score) {
|
||||||
candidate = 1;
|
candidate = 1;
|
||||||
best_score = score;
|
best_score = score;
|
||||||
}
|
}
|
||||||
score = score_trees(&sub2, hash1);
|
score = score_trees(r, &sub2, hash1);
|
||||||
if (score > best_score)
|
if (score > best_score)
|
||||||
candidate = 2;
|
candidate = 2;
|
||||||
}
|
}
|
||||||
@@ -365,7 +369,7 @@ void shift_tree_by(struct repository *r,
|
|||||||
* shift tree2 down by adding shift_prefix above it
|
* shift tree2 down by adding shift_prefix above it
|
||||||
* to match tree1.
|
* to match tree1.
|
||||||
*/
|
*/
|
||||||
splice_tree(hash1, shift_prefix, hash2, shifted);
|
splice_tree(r, hash1, shift_prefix, hash2, shifted);
|
||||||
else
|
else
|
||||||
/*
|
/*
|
||||||
* shift tree2 up by removing shift_prefix from it
|
* shift tree2 up by removing shift_prefix from it
|
||||||
|
|||||||
11
midx-write.c
11
midx-write.c
@@ -1131,7 +1131,8 @@ static int write_midx_internal(struct repository *r, const char *object_dir,
|
|||||||
|
|
||||||
ctx.pack_paths_checked = 0;
|
ctx.pack_paths_checked = 0;
|
||||||
if (flags & MIDX_PROGRESS)
|
if (flags & MIDX_PROGRESS)
|
||||||
ctx.progress = start_delayed_progress(_("Adding packfiles to multi-pack-index"), 0);
|
ctx.progress = start_delayed_progress(r,
|
||||||
|
_("Adding packfiles to multi-pack-index"), 0);
|
||||||
else
|
else
|
||||||
ctx.progress = NULL;
|
ctx.progress = NULL;
|
||||||
|
|
||||||
@@ -1539,7 +1540,9 @@ int expire_midx_packs(struct repository *r, const char *object_dir, unsigned fla
|
|||||||
CALLOC_ARRAY(count, m->num_packs);
|
CALLOC_ARRAY(count, m->num_packs);
|
||||||
|
|
||||||
if (flags & MIDX_PROGRESS)
|
if (flags & MIDX_PROGRESS)
|
||||||
progress = start_delayed_progress(_("Counting referenced objects"),
|
progress = start_delayed_progress(
|
||||||
|
r,
|
||||||
|
_("Counting referenced objects"),
|
||||||
m->num_objects);
|
m->num_objects);
|
||||||
for (i = 0; i < m->num_objects; i++) {
|
for (i = 0; i < m->num_objects; i++) {
|
||||||
int pack_int_id = nth_midxed_pack_int_id(m, i);
|
int pack_int_id = nth_midxed_pack_int_id(m, i);
|
||||||
@@ -1549,7 +1552,9 @@ int expire_midx_packs(struct repository *r, const char *object_dir, unsigned fla
|
|||||||
stop_progress(&progress);
|
stop_progress(&progress);
|
||||||
|
|
||||||
if (flags & MIDX_PROGRESS)
|
if (flags & MIDX_PROGRESS)
|
||||||
progress = start_delayed_progress(_("Finding and deleting unreferenced packfiles"),
|
progress = start_delayed_progress(
|
||||||
|
r,
|
||||||
|
_("Finding and deleting unreferenced packfiles"),
|
||||||
m->num_packs);
|
m->num_packs);
|
||||||
for (i = 0; i < m->num_packs; i++) {
|
for (i = 0; i < m->num_packs; i++) {
|
||||||
char *pack_name;
|
char *pack_name;
|
||||||
|
|||||||
13
midx.c
13
midx.c
@@ -907,7 +907,8 @@ int verify_midx_file(struct repository *r, const char *object_dir, unsigned flag
|
|||||||
midx_report(_("incorrect checksum"));
|
midx_report(_("incorrect checksum"));
|
||||||
|
|
||||||
if (flags & MIDX_PROGRESS)
|
if (flags & MIDX_PROGRESS)
|
||||||
progress = start_delayed_progress(_("Looking for referenced packfiles"),
|
progress = start_delayed_progress(r,
|
||||||
|
_("Looking for referenced packfiles"),
|
||||||
m->num_packs + m->num_packs_in_base);
|
m->num_packs + m->num_packs_in_base);
|
||||||
for (i = 0; i < m->num_packs + m->num_packs_in_base; i++) {
|
for (i = 0; i < m->num_packs + m->num_packs_in_base; i++) {
|
||||||
if (prepare_midx_pack(r, m, i))
|
if (prepare_midx_pack(r, m, i))
|
||||||
@@ -927,7 +928,8 @@ int verify_midx_file(struct repository *r, const char *object_dir, unsigned flag
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flags & MIDX_PROGRESS)
|
if (flags & MIDX_PROGRESS)
|
||||||
progress = start_sparse_progress(_("Verifying OID order in multi-pack-index"),
|
progress = start_sparse_progress(r,
|
||||||
|
_("Verifying OID order in multi-pack-index"),
|
||||||
m->num_objects - 1);
|
m->num_objects - 1);
|
||||||
|
|
||||||
for (curr = m; curr; curr = curr->base_midx) {
|
for (curr = m; curr; curr = curr->base_midx) {
|
||||||
@@ -959,14 +961,17 @@ int verify_midx_file(struct repository *r, const char *object_dir, unsigned flag
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flags & MIDX_PROGRESS)
|
if (flags & MIDX_PROGRESS)
|
||||||
progress = start_sparse_progress(_("Sorting objects by packfile"),
|
progress = start_sparse_progress(r,
|
||||||
|
_("Sorting objects by packfile"),
|
||||||
m->num_objects);
|
m->num_objects);
|
||||||
display_progress(progress, 0); /* TODO: Measure QSORT() progress */
|
display_progress(progress, 0); /* TODO: Measure QSORT() progress */
|
||||||
QSORT(pairs, m->num_objects, compare_pair_pos_vs_id);
|
QSORT(pairs, m->num_objects, compare_pair_pos_vs_id);
|
||||||
stop_progress(&progress);
|
stop_progress(&progress);
|
||||||
|
|
||||||
if (flags & MIDX_PROGRESS)
|
if (flags & MIDX_PROGRESS)
|
||||||
progress = start_sparse_progress(_("Verifying object offsets"), m->num_objects);
|
progress = start_sparse_progress(r,
|
||||||
|
_("Verifying object offsets"),
|
||||||
|
m->num_objects);
|
||||||
for (i = 0; i < m->num_objects + m->num_objects_in_base; i++) {
|
for (i = 0; i < m->num_objects + m->num_objects_in_base; i++) {
|
||||||
struct object_id oid;
|
struct object_id oid;
|
||||||
struct pack_entry e;
|
struct pack_entry e;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
|||||||
res = parse_attr_line(buf, "dummy", 0, 0);
|
res = parse_attr_line(buf, "dummy", 0, 0);
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
int j;
|
size_t j;
|
||||||
for (j = 0; j < res->num_attr; j++) {
|
for (j = 0; j < res->num_attr; j++) {
|
||||||
const char *setto = res->state[j].setto;
|
const char *setto = res->state[j].setto;
|
||||||
if (ATTR_TRUE(setto) || ATTR_FALSE(setto) ||
|
if (ATTR_TRUE(setto) || ATTR_FALSE(setto) ||
|
||||||
|
|||||||
@@ -590,7 +590,8 @@ int bitmap_writer_build(struct bitmap_writer *writer)
|
|||||||
int closed = 1; /* until proven otherwise */
|
int closed = 1; /* until proven otherwise */
|
||||||
|
|
||||||
if (writer->show_progress)
|
if (writer->show_progress)
|
||||||
writer->progress = start_progress("Building bitmaps",
|
writer->progress = start_progress(the_repository,
|
||||||
|
"Building bitmaps",
|
||||||
writer->selected_nr);
|
writer->selected_nr);
|
||||||
trace2_region_enter("pack-bitmap-write", "building_bitmaps_total",
|
trace2_region_enter("pack-bitmap-write", "building_bitmaps_total",
|
||||||
the_repository);
|
the_repository);
|
||||||
@@ -710,7 +711,8 @@ void bitmap_writer_select_commits(struct bitmap_writer *writer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (writer->show_progress)
|
if (writer->show_progress)
|
||||||
writer->progress = start_progress("Selecting bitmap commits", 0);
|
writer->progress = start_progress(the_repository,
|
||||||
|
"Selecting bitmap commits", 0);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
struct commit *chosen = NULL;
|
struct commit *chosen = NULL;
|
||||||
|
|||||||
@@ -2573,7 +2573,9 @@ void test_bitmap_walk(struct rev_info *revs)
|
|||||||
tdata.trees = ewah_to_bitmap(bitmap_git->trees);
|
tdata.trees = ewah_to_bitmap(bitmap_git->trees);
|
||||||
tdata.blobs = ewah_to_bitmap(bitmap_git->blobs);
|
tdata.blobs = ewah_to_bitmap(bitmap_git->blobs);
|
||||||
tdata.tags = ewah_to_bitmap(bitmap_git->tags);
|
tdata.tags = ewah_to_bitmap(bitmap_git->tags);
|
||||||
tdata.prg = start_progress("Verifying bitmap entries", result_popcnt);
|
tdata.prg = start_progress(revs->repo,
|
||||||
|
"Verifying bitmap entries",
|
||||||
|
result_popcnt);
|
||||||
tdata.seen = 0;
|
tdata.seen = 0;
|
||||||
|
|
||||||
traverse_commit_list(revs, &test_show_commit, &test_show_object, &tdata);
|
traverse_commit_list(revs, &test_show_commit, &test_show_object, &tdata);
|
||||||
|
|||||||
14
pager.c
14
pager.c
@@ -1,5 +1,3 @@
|
|||||||
#define USE_THE_REPOSITORY_VARIABLE
|
|
||||||
|
|
||||||
#include "git-compat-util.h"
|
#include "git-compat-util.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "editor.h"
|
#include "editor.h"
|
||||||
@@ -84,7 +82,7 @@ static int core_pager_config(const char *var, const char *value,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *git_pager(int stdout_is_tty)
|
const char *git_pager(struct repository *r, int stdout_is_tty)
|
||||||
{
|
{
|
||||||
const char *pager;
|
const char *pager;
|
||||||
|
|
||||||
@@ -94,7 +92,7 @@ const char *git_pager(int stdout_is_tty)
|
|||||||
pager = getenv("GIT_PAGER");
|
pager = getenv("GIT_PAGER");
|
||||||
if (!pager) {
|
if (!pager) {
|
||||||
if (!pager_program)
|
if (!pager_program)
|
||||||
read_early_config(the_repository,
|
read_early_config(r,
|
||||||
core_pager_config, NULL);
|
core_pager_config, NULL);
|
||||||
pager = pager_program;
|
pager = pager_program;
|
||||||
}
|
}
|
||||||
@@ -143,10 +141,10 @@ void prepare_pager_args(struct child_process *pager_process, const char *pager)
|
|||||||
pager_process->trace2_child_class = "pager";
|
pager_process->trace2_child_class = "pager";
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_pager(void)
|
void setup_pager(struct repository *r)
|
||||||
{
|
{
|
||||||
static int once = 0;
|
static int once = 0;
|
||||||
const char *pager = git_pager(isatty(1));
|
const char *pager = git_pager(r, isatty(1));
|
||||||
|
|
||||||
if (!pager)
|
if (!pager)
|
||||||
return;
|
return;
|
||||||
@@ -293,7 +291,7 @@ static int pager_command_config(const char *var, const char *value,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* returns 0 for "no pager", 1 for "use pager", and -1 for "not specified" */
|
/* returns 0 for "no pager", 1 for "use pager", and -1 for "not specified" */
|
||||||
int check_pager_config(const char *cmd)
|
int check_pager_config(struct repository *r, const char *cmd)
|
||||||
{
|
{
|
||||||
struct pager_command_config_data data;
|
struct pager_command_config_data data;
|
||||||
|
|
||||||
@@ -301,7 +299,7 @@ int check_pager_config(const char *cmd)
|
|||||||
data.want = -1;
|
data.want = -1;
|
||||||
data.value = NULL;
|
data.value = NULL;
|
||||||
|
|
||||||
read_early_config(the_repository, pager_command_config, &data);
|
read_early_config(r, pager_command_config, &data);
|
||||||
|
|
||||||
if (data.value)
|
if (data.value)
|
||||||
pager_program = data.value;
|
pager_program = data.value;
|
||||||
|
|||||||
7
pager.h
7
pager.h
@@ -2,15 +2,16 @@
|
|||||||
#define PAGER_H
|
#define PAGER_H
|
||||||
|
|
||||||
struct child_process;
|
struct child_process;
|
||||||
|
struct repository;
|
||||||
|
|
||||||
const char *git_pager(int stdout_is_tty);
|
const char *git_pager(struct repository *r, int stdout_is_tty);
|
||||||
void setup_pager(void);
|
void setup_pager(struct repository *r);
|
||||||
void wait_for_pager(void);
|
void wait_for_pager(void);
|
||||||
int pager_in_use(void);
|
int pager_in_use(void);
|
||||||
int term_columns(void);
|
int term_columns(void);
|
||||||
void term_clear_line(void);
|
void term_clear_line(void);
|
||||||
int decimal_width(uintmax_t);
|
int decimal_width(uintmax_t);
|
||||||
int check_pager_config(const char *cmd);
|
int check_pager_config(struct repository *r, const char *cmd);
|
||||||
void prepare_pager_args(struct child_process *, const char *pager);
|
void prepare_pager_args(struct child_process *, const char *pager);
|
||||||
|
|
||||||
extern int pager_use_color;
|
extern int pager_use_color;
|
||||||
|
|||||||
@@ -132,7 +132,9 @@ void preload_index(struct index_state *index,
|
|||||||
|
|
||||||
memset(&pd, 0, sizeof(pd));
|
memset(&pd, 0, sizeof(pd));
|
||||||
if (refresh_flags & REFRESH_PROGRESS && isatty(2)) {
|
if (refresh_flags & REFRESH_PROGRESS && isatty(2)) {
|
||||||
pd.progress = start_delayed_progress(_("Refreshing index"), index->cache_nr);
|
pd.progress = start_delayed_progress(the_repository,
|
||||||
|
_("Refreshing index"),
|
||||||
|
index->cache_nr);
|
||||||
pthread_mutex_init(&pd.mutex, NULL);
|
pthread_mutex_init(&pd.mutex, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
34
progress.c
34
progress.c
@@ -9,7 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define GIT_TEST_PROGRESS_ONLY
|
#define GIT_TEST_PROGRESS_ONLY
|
||||||
#define USE_THE_REPOSITORY_VARIABLE
|
|
||||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||||
|
|
||||||
#include "git-compat-util.h"
|
#include "git-compat-util.h"
|
||||||
@@ -37,6 +36,7 @@ struct throughput {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct progress {
|
struct progress {
|
||||||
|
struct repository *repo;
|
||||||
const char *title;
|
const char *title;
|
||||||
uint64_t last_value;
|
uint64_t last_value;
|
||||||
uint64_t total;
|
uint64_t total;
|
||||||
@@ -254,10 +254,12 @@ void display_progress(struct progress *progress, uint64_t n)
|
|||||||
display(progress, n, NULL);
|
display(progress, n, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct progress *start_progress_delay(const char *title, uint64_t total,
|
static struct progress *start_progress_delay(struct repository *r,
|
||||||
|
const char *title, uint64_t total,
|
||||||
unsigned delay, unsigned sparse)
|
unsigned delay, unsigned sparse)
|
||||||
{
|
{
|
||||||
struct progress *progress = xmalloc(sizeof(*progress));
|
struct progress *progress = xmalloc(sizeof(*progress));
|
||||||
|
progress->repo = r;
|
||||||
progress->title = title;
|
progress->title = title;
|
||||||
progress->total = total;
|
progress->total = total;
|
||||||
progress->last_value = -1;
|
progress->last_value = -1;
|
||||||
@@ -270,7 +272,7 @@ static struct progress *start_progress_delay(const char *title, uint64_t total,
|
|||||||
progress->title_len = utf8_strwidth(title);
|
progress->title_len = utf8_strwidth(title);
|
||||||
progress->split = 0;
|
progress->split = 0;
|
||||||
set_progress_signal();
|
set_progress_signal();
|
||||||
trace2_region_enter("progress", title, the_repository);
|
trace2_region_enter("progress", title, r);
|
||||||
return progress;
|
return progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,14 +286,16 @@ static int get_default_delay(void)
|
|||||||
return delay_in_secs;
|
return delay_in_secs;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct progress *start_delayed_progress(const char *title, uint64_t total)
|
struct progress *start_delayed_progress(struct repository *r,
|
||||||
|
const char *title, uint64_t total)
|
||||||
{
|
{
|
||||||
return start_progress_delay(title, total, get_default_delay(), 0);
|
return start_progress_delay(r, title, total, get_default_delay(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct progress *start_progress(const char *title, uint64_t total)
|
struct progress *start_progress(struct repository *r,
|
||||||
|
const char *title, uint64_t total)
|
||||||
{
|
{
|
||||||
return start_progress_delay(title, total, 0, 0);
|
return start_progress_delay(r, title, total, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -303,15 +307,17 @@ struct progress *start_progress(const char *title, uint64_t total)
|
|||||||
* When "sparse" is set, stop_progress() will automatically force the done
|
* When "sparse" is set, stop_progress() will automatically force the done
|
||||||
* message to show 100%.
|
* message to show 100%.
|
||||||
*/
|
*/
|
||||||
struct progress *start_sparse_progress(const char *title, uint64_t total)
|
struct progress *start_sparse_progress(struct repository *r,
|
||||||
|
const char *title, uint64_t total)
|
||||||
{
|
{
|
||||||
return start_progress_delay(title, total, 0, 1);
|
return start_progress_delay(r, title, total, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct progress *start_delayed_sparse_progress(const char *title,
|
struct progress *start_delayed_sparse_progress(struct repository *r,
|
||||||
|
const char *title,
|
||||||
uint64_t total)
|
uint64_t total)
|
||||||
{
|
{
|
||||||
return start_progress_delay(title, total, get_default_delay(), 1);
|
return start_progress_delay(r, title, total, get_default_delay(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void finish_if_sparse(struct progress *progress)
|
static void finish_if_sparse(struct progress *progress)
|
||||||
@@ -341,14 +347,14 @@ static void force_last_update(struct progress *progress, const char *msg)
|
|||||||
|
|
||||||
static void log_trace2(struct progress *progress)
|
static void log_trace2(struct progress *progress)
|
||||||
{
|
{
|
||||||
trace2_data_intmax("progress", the_repository, "total_objects",
|
trace2_data_intmax("progress", progress->repo, "total_objects",
|
||||||
progress->total);
|
progress->total);
|
||||||
|
|
||||||
if (progress->throughput)
|
if (progress->throughput)
|
||||||
trace2_data_intmax("progress", the_repository, "total_bytes",
|
trace2_data_intmax("progress", progress->repo, "total_bytes",
|
||||||
progress->throughput->curr_total);
|
progress->throughput->curr_total);
|
||||||
|
|
||||||
trace2_region_leave("progress", progress->title, the_repository);
|
trace2_region_leave("progress", progress->title, progress->repo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void stop_progress_msg(struct progress **p_progress, const char *msg)
|
void stop_progress_msg(struct progress **p_progress, const char *msg)
|
||||||
|
|||||||
13
progress.h
13
progress.h
@@ -3,6 +3,7 @@
|
|||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
|
|
||||||
struct progress;
|
struct progress;
|
||||||
|
struct repository;
|
||||||
|
|
||||||
#ifdef GIT_TEST_PROGRESS_ONLY
|
#ifdef GIT_TEST_PROGRESS_ONLY
|
||||||
|
|
||||||
@@ -14,10 +15,14 @@ void progress_test_force_update(void);
|
|||||||
|
|
||||||
void display_throughput(struct progress *progress, uint64_t total);
|
void display_throughput(struct progress *progress, uint64_t total);
|
||||||
void display_progress(struct progress *progress, uint64_t n);
|
void display_progress(struct progress *progress, uint64_t n);
|
||||||
struct progress *start_progress(const char *title, uint64_t total);
|
struct progress *start_progress(struct repository *r,
|
||||||
struct progress *start_sparse_progress(const char *title, uint64_t total);
|
const char *title, uint64_t total);
|
||||||
struct progress *start_delayed_progress(const char *title, uint64_t total);
|
struct progress *start_sparse_progress(struct repository *r,
|
||||||
struct progress *start_delayed_sparse_progress(const char *title,
|
const char *title, uint64_t total);
|
||||||
|
struct progress *start_delayed_progress(struct repository *r,
|
||||||
|
const char *title, uint64_t total);
|
||||||
|
struct progress *start_delayed_sparse_progress(struct repository *r,
|
||||||
|
const char *title,
|
||||||
uint64_t total);
|
uint64_t total);
|
||||||
void stop_progress_msg(struct progress **p_progress, const char *msg);
|
void stop_progress_msg(struct progress **p_progress, const char *msg);
|
||||||
static inline void stop_progress(struct progress **p_progress)
|
static inline void stop_progress(struct progress **p_progress)
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ static int prune_object(const struct object_id *oid, const char *path,
|
|||||||
void prune_packed_objects(int opts)
|
void prune_packed_objects(int opts)
|
||||||
{
|
{
|
||||||
if (opts & PRUNE_PACKED_VERBOSE)
|
if (opts & PRUNE_PACKED_VERBOSE)
|
||||||
progress = start_delayed_progress(_("Removing duplicate objects"), 256);
|
progress = start_delayed_progress(the_repository,
|
||||||
|
_("Removing duplicate objects"), 256);
|
||||||
|
|
||||||
for_each_loose_file_in_objdir(repo_get_object_directory(the_repository),
|
for_each_loose_file_in_objdir(repo_get_object_directory(the_repository),
|
||||||
prune_object, NULL, prune_subdir, &opts);
|
prune_object, NULL, prune_subdir, &opts);
|
||||||
|
|||||||
@@ -459,7 +459,8 @@ void select_pseudo_merges(struct bitmap_writer *writer)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (writer->show_progress)
|
if (writer->show_progress)
|
||||||
progress = start_progress("Selecting pseudo-merge commits",
|
progress = start_progress(the_repository,
|
||||||
|
"Selecting pseudo-merge commits",
|
||||||
writer->pseudo_merge_groups.nr);
|
writer->pseudo_merge_groups.nr);
|
||||||
|
|
||||||
refs_for_each_ref(get_main_ref_store(the_repository),
|
refs_for_each_ref(get_main_ref_store(the_repository),
|
||||||
|
|||||||
@@ -1523,7 +1523,8 @@ int refresh_index(struct index_state *istate, unsigned int flags,
|
|||||||
int t2_sum_scan = 0;
|
int t2_sum_scan = 0;
|
||||||
|
|
||||||
if (flags & REFRESH_PROGRESS && isatty(2))
|
if (flags & REFRESH_PROGRESS && isatty(2))
|
||||||
progress = start_delayed_progress(_("Refresh index"),
|
progress = start_delayed_progress(the_repository,
|
||||||
|
_("Refresh index"),
|
||||||
istate->cache_nr);
|
istate->cache_nr);
|
||||||
|
|
||||||
trace_performance_enter();
|
trace_performance_enter();
|
||||||
@@ -1753,7 +1754,7 @@ static int read_index_extension(struct index_state *istate,
|
|||||||
istate->cache_tree = cache_tree_read(data, sz);
|
istate->cache_tree = cache_tree_read(data, sz);
|
||||||
break;
|
break;
|
||||||
case CACHE_EXT_RESOLVE_UNDO:
|
case CACHE_EXT_RESOLVE_UNDO:
|
||||||
istate->resolve_undo = resolve_undo_read(data, sz);
|
istate->resolve_undo = resolve_undo_read(data, sz, the_hash_algo);
|
||||||
break;
|
break;
|
||||||
case CACHE_EXT_LINK:
|
case CACHE_EXT_LINK:
|
||||||
if (read_link_extension(istate, data, sz))
|
if (read_link_extension(istate, data, sz))
|
||||||
@@ -3032,7 +3033,7 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
|
|||||||
istate->resolve_undo) {
|
istate->resolve_undo) {
|
||||||
strbuf_reset(&sb);
|
strbuf_reset(&sb);
|
||||||
|
|
||||||
resolve_undo_write(&sb, istate->resolve_undo);
|
resolve_undo_write(&sb, istate->resolve_undo, the_hash_algo);
|
||||||
err = write_index_ext_header(f, eoie_c, CACHE_EXT_RESOLVE_UNDO,
|
err = write_index_ext_header(f, eoie_c, CACHE_EXT_RESOLVE_UNDO,
|
||||||
sb.len) < 0;
|
sb.len) < 0;
|
||||||
hashwrite(f, sb.buf, sb.len);
|
hashwrite(f, sb.buf, sb.len);
|
||||||
|
|||||||
@@ -942,7 +942,7 @@ static int post_rpc(struct rpc_state *rpc, int stateless_connect, int flush_rece
|
|||||||
do {
|
do {
|
||||||
err = probe_rpc(rpc, &results);
|
err = probe_rpc(rpc, &results);
|
||||||
if (err == HTTP_REAUTH)
|
if (err == HTTP_REAUTH)
|
||||||
credential_fill(&http_auth, 0);
|
credential_fill(the_repository, &http_auth, 0);
|
||||||
} while (err == HTTP_REAUTH);
|
} while (err == HTTP_REAUTH);
|
||||||
if (err != HTTP_OK)
|
if (err != HTTP_OK)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1064,7 +1064,7 @@ retry:
|
|||||||
rpc->any_written = 0;
|
rpc->any_written = 0;
|
||||||
err = run_slot(slot, NULL);
|
err = run_slot(slot, NULL);
|
||||||
if (err == HTTP_REAUTH && !large_request) {
|
if (err == HTTP_REAUTH && !large_request) {
|
||||||
credential_fill(&http_auth, 0);
|
credential_fill(the_repository, &http_auth, 0);
|
||||||
curl_slist_free_all(headers);
|
curl_slist_free_all(headers);
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#define USE_THE_REPOSITORY_VARIABLE
|
|
||||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||||
|
|
||||||
#include "git-compat-util.h"
|
#include "git-compat-util.h"
|
||||||
@@ -34,7 +33,8 @@ void record_resolve_undo(struct index_state *istate, struct cache_entry *ce)
|
|||||||
ui->mode[stage - 1] = ce->ce_mode;
|
ui->mode[stage - 1] = ce->ce_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void resolve_undo_write(struct strbuf *sb, struct string_list *resolve_undo)
|
void resolve_undo_write(struct strbuf *sb, struct string_list *resolve_undo,
|
||||||
|
const struct git_hash_algo *algop)
|
||||||
{
|
{
|
||||||
struct string_list_item *item;
|
struct string_list_item *item;
|
||||||
for_each_string_list_item(item, resolve_undo) {
|
for_each_string_list_item(item, resolve_undo) {
|
||||||
@@ -50,18 +50,19 @@ void resolve_undo_write(struct strbuf *sb, struct string_list *resolve_undo)
|
|||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
if (!ui->mode[i])
|
if (!ui->mode[i])
|
||||||
continue;
|
continue;
|
||||||
strbuf_add(sb, ui->oid[i].hash, the_hash_algo->rawsz);
|
strbuf_add(sb, ui->oid[i].hash, algop->rawsz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct string_list *resolve_undo_read(const char *data, unsigned long size)
|
struct string_list *resolve_undo_read(const char *data, unsigned long size,
|
||||||
|
const struct git_hash_algo *algop)
|
||||||
{
|
{
|
||||||
struct string_list *resolve_undo;
|
struct string_list *resolve_undo;
|
||||||
size_t len;
|
size_t len;
|
||||||
char *endptr;
|
char *endptr;
|
||||||
int i;
|
int i;
|
||||||
const unsigned rawsz = the_hash_algo->rawsz;
|
const unsigned rawsz = algop->rawsz;
|
||||||
|
|
||||||
CALLOC_ARRAY(resolve_undo, 1);
|
CALLOC_ARRAY(resolve_undo, 1);
|
||||||
resolve_undo->strdup_strings = 1;
|
resolve_undo->strdup_strings = 1;
|
||||||
@@ -96,8 +97,7 @@ struct string_list *resolve_undo_read(const char *data, unsigned long size)
|
|||||||
continue;
|
continue;
|
||||||
if (size < rawsz)
|
if (size < rawsz)
|
||||||
goto error;
|
goto error;
|
||||||
oidread(&ui->oid[i], (const unsigned char *)data,
|
oidread(&ui->oid[i], (const unsigned char *)data, algop);
|
||||||
the_repository->hash_algo);
|
|
||||||
size -= rawsz;
|
size -= rawsz;
|
||||||
data += rawsz;
|
data += rawsz;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,8 +14,10 @@ struct resolve_undo_info {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void record_resolve_undo(struct index_state *, struct cache_entry *);
|
void record_resolve_undo(struct index_state *, struct cache_entry *);
|
||||||
void resolve_undo_write(struct strbuf *, struct string_list *);
|
void resolve_undo_write(struct strbuf *, struct string_list *,
|
||||||
struct string_list *resolve_undo_read(const char *, unsigned long);
|
const struct git_hash_algo *algop);
|
||||||
|
struct string_list *resolve_undo_read(const char *, unsigned long,
|
||||||
|
const struct git_hash_algo *algop);
|
||||||
void resolve_undo_clear_index(struct index_state *);
|
void resolve_undo_clear_index(struct index_state *);
|
||||||
int unmerge_index_entry(struct index_state *, const char *, struct resolve_undo_info *, unsigned);
|
int unmerge_index_entry(struct index_state *, const char *, struct resolve_undo_info *, unsigned);
|
||||||
void unmerge_index(struct index_state *, const struct pathspec *, unsigned);
|
void unmerge_index(struct index_state *, const struct pathspec *, unsigned);
|
||||||
|
|||||||
77
send-pack.c
77
send-pack.c
@@ -1,5 +1,3 @@
|
|||||||
#define USE_THE_REPOSITORY_VARIABLE
|
|
||||||
|
|
||||||
#include "git-compat-util.h"
|
#include "git-compat-util.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "commit.h"
|
#include "commit.h"
|
||||||
@@ -44,10 +42,11 @@ int option_parse_push_signed(const struct option *opt,
|
|||||||
die("bad %s argument: %s", opt->long_name, arg);
|
die("bad %s argument: %s", opt->long_name, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void feed_object(const struct object_id *oid, FILE *fh, int negative)
|
static void feed_object(struct repository *r,
|
||||||
|
const struct object_id *oid, FILE *fh, int negative)
|
||||||
{
|
{
|
||||||
if (negative &&
|
if (negative &&
|
||||||
!repo_has_object_file_with_flags(the_repository, oid,
|
!repo_has_object_file_with_flags(r, oid,
|
||||||
OBJECT_INFO_SKIP_FETCH_OBJECT |
|
OBJECT_INFO_SKIP_FETCH_OBJECT |
|
||||||
OBJECT_INFO_QUICK))
|
OBJECT_INFO_QUICK))
|
||||||
return;
|
return;
|
||||||
@@ -61,7 +60,8 @@ static void feed_object(const struct object_id *oid, FILE *fh, int negative)
|
|||||||
/*
|
/*
|
||||||
* Make a pack stream and spit it out into file descriptor fd
|
* Make a pack stream and spit it out into file descriptor fd
|
||||||
*/
|
*/
|
||||||
static int pack_objects(int fd, struct ref *refs, struct oid_array *advertised,
|
static int pack_objects(struct repository *r,
|
||||||
|
int fd, struct ref *refs, struct oid_array *advertised,
|
||||||
struct oid_array *negotiated,
|
struct oid_array *negotiated,
|
||||||
struct send_pack_args *args)
|
struct send_pack_args *args)
|
||||||
{
|
{
|
||||||
@@ -74,7 +74,7 @@ static int pack_objects(int fd, struct ref *refs, struct oid_array *advertised,
|
|||||||
FILE *po_in;
|
FILE *po_in;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
trace2_region_enter("send_pack", "pack_objects", the_repository);
|
trace2_region_enter("send_pack", "pack_objects", r);
|
||||||
strvec_push(&po.args, "pack-objects");
|
strvec_push(&po.args, "pack-objects");
|
||||||
strvec_push(&po.args, "--all-progress-implied");
|
strvec_push(&po.args, "--all-progress-implied");
|
||||||
strvec_push(&po.args, "--revs");
|
strvec_push(&po.args, "--revs");
|
||||||
@@ -87,7 +87,7 @@ static int pack_objects(int fd, struct ref *refs, struct oid_array *advertised,
|
|||||||
strvec_push(&po.args, "-q");
|
strvec_push(&po.args, "-q");
|
||||||
if (args->progress)
|
if (args->progress)
|
||||||
strvec_push(&po.args, "--progress");
|
strvec_push(&po.args, "--progress");
|
||||||
if (is_repository_shallow(the_repository))
|
if (is_repository_shallow(r))
|
||||||
strvec_push(&po.args, "--shallow");
|
strvec_push(&po.args, "--shallow");
|
||||||
if (args->disable_bitmaps)
|
if (args->disable_bitmaps)
|
||||||
strvec_push(&po.args, "--no-use-bitmap-index");
|
strvec_push(&po.args, "--no-use-bitmap-index");
|
||||||
@@ -104,15 +104,15 @@ static int pack_objects(int fd, struct ref *refs, struct oid_array *advertised,
|
|||||||
*/
|
*/
|
||||||
po_in = xfdopen(po.in, "w");
|
po_in = xfdopen(po.in, "w");
|
||||||
for (size_t i = 0; i < advertised->nr; i++)
|
for (size_t i = 0; i < advertised->nr; i++)
|
||||||
feed_object(&advertised->oid[i], po_in, 1);
|
feed_object(r, &advertised->oid[i], po_in, 1);
|
||||||
for (size_t i = 0; i < negotiated->nr; i++)
|
for (size_t i = 0; i < negotiated->nr; i++)
|
||||||
feed_object(&negotiated->oid[i], po_in, 1);
|
feed_object(r, &negotiated->oid[i], po_in, 1);
|
||||||
|
|
||||||
while (refs) {
|
while (refs) {
|
||||||
if (!is_null_oid(&refs->old_oid))
|
if (!is_null_oid(&refs->old_oid))
|
||||||
feed_object(&refs->old_oid, po_in, 1);
|
feed_object(r, &refs->old_oid, po_in, 1);
|
||||||
if (!is_null_oid(&refs->new_oid))
|
if (!is_null_oid(&refs->new_oid))
|
||||||
feed_object(&refs->new_oid, po_in, 0);
|
feed_object(r, &refs->new_oid, po_in, 0);
|
||||||
refs = refs->next;
|
refs = refs->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,10 +146,10 @@ static int pack_objects(int fd, struct ref *refs, struct oid_array *advertised,
|
|||||||
*/
|
*/
|
||||||
if (rc > 128 && rc != 141)
|
if (rc > 128 && rc != 141)
|
||||||
error("pack-objects died of signal %d", rc - 128);
|
error("pack-objects died of signal %d", rc - 128);
|
||||||
trace2_region_leave("send_pack", "pack_objects", the_repository);
|
trace2_region_leave("send_pack", "pack_objects", r);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
trace2_region_leave("send_pack", "pack_objects", the_repository);
|
trace2_region_leave("send_pack", "pack_objects", r);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +164,8 @@ static int receive_unpack_status(struct packet_reader *reader)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int receive_status(struct packet_reader *reader, struct ref *refs)
|
static int receive_status(struct repository *r,
|
||||||
|
struct packet_reader *reader, struct ref *refs)
|
||||||
{
|
{
|
||||||
struct ref *hint;
|
struct ref *hint;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -172,7 +173,7 @@ static int receive_status(struct packet_reader *reader, struct ref *refs)
|
|||||||
int new_report = 0;
|
int new_report = 0;
|
||||||
int once = 0;
|
int once = 0;
|
||||||
|
|
||||||
trace2_region_enter("send_pack", "receive_status", the_repository);
|
trace2_region_enter("send_pack", "receive_status", r);
|
||||||
hint = NULL;
|
hint = NULL;
|
||||||
ret = receive_unpack_status(reader);
|
ret = receive_unpack_status(reader);
|
||||||
while (1) {
|
while (1) {
|
||||||
@@ -221,10 +222,10 @@ static int receive_status(struct packet_reader *reader, struct ref *refs)
|
|||||||
if (!strcmp(key, "refname"))
|
if (!strcmp(key, "refname"))
|
||||||
report->ref_name = xstrdup_or_null(val);
|
report->ref_name = xstrdup_or_null(val);
|
||||||
else if (!strcmp(key, "old-oid") && val &&
|
else if (!strcmp(key, "old-oid") && val &&
|
||||||
!parse_oid_hex(val, &old_oid, &val))
|
!parse_oid_hex_algop(val, &old_oid, &val, r->hash_algo))
|
||||||
report->old_oid = oiddup(&old_oid);
|
report->old_oid = oiddup(&old_oid);
|
||||||
else if (!strcmp(key, "new-oid") && val &&
|
else if (!strcmp(key, "new-oid") && val &&
|
||||||
!parse_oid_hex(val, &new_oid, &val))
|
!parse_oid_hex_algop(val, &new_oid, &val, r->hash_algo))
|
||||||
report->new_oid = oiddup(&new_oid);
|
report->new_oid = oiddup(&new_oid);
|
||||||
else if (!strcmp(key, "forced-update"))
|
else if (!strcmp(key, "forced-update"))
|
||||||
report->forced_update = 1;
|
report->forced_update = 1;
|
||||||
@@ -271,7 +272,7 @@ static int receive_status(struct packet_reader *reader, struct ref *refs)
|
|||||||
new_report = 1;
|
new_report = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
trace2_region_leave("send_pack", "receive_status", the_repository);
|
trace2_region_leave("send_pack", "receive_status", r);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,9 +294,9 @@ static int advertise_shallow_grafts_cb(const struct commit_graft *graft, void *c
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void advertise_shallow_grafts_buf(struct strbuf *sb)
|
static void advertise_shallow_grafts_buf(struct repository *r, struct strbuf *sb)
|
||||||
{
|
{
|
||||||
if (!is_repository_shallow(the_repository))
|
if (!is_repository_shallow(r))
|
||||||
return;
|
return;
|
||||||
for_each_commit_graft(advertise_shallow_grafts_cb, sb);
|
for_each_commit_graft(advertise_shallow_grafts_cb, sb);
|
||||||
}
|
}
|
||||||
@@ -426,13 +427,14 @@ static void reject_invalid_nonce(const char *nonce, int len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_commons_through_negotiation(const char *url,
|
static void get_commons_through_negotiation(struct repository *r,
|
||||||
|
const char *url,
|
||||||
const struct ref *remote_refs,
|
const struct ref *remote_refs,
|
||||||
struct oid_array *commons)
|
struct oid_array *commons)
|
||||||
{
|
{
|
||||||
struct child_process child = CHILD_PROCESS_INIT;
|
struct child_process child = CHILD_PROCESS_INIT;
|
||||||
const struct ref *ref;
|
const struct ref *ref;
|
||||||
int len = the_hash_algo->hexsz + 1; /* hash + NL */
|
int len = r->hash_algo->hexsz + 1; /* hash + NL */
|
||||||
int nr_negotiation_tip = 0;
|
int nr_negotiation_tip = 0;
|
||||||
|
|
||||||
child.git_cmd = 1;
|
child.git_cmd = 1;
|
||||||
@@ -466,7 +468,7 @@ static void get_commons_through_negotiation(const char *url,
|
|||||||
break;
|
break;
|
||||||
if (read_len != len)
|
if (read_len != len)
|
||||||
die("invalid length read %d", read_len);
|
die("invalid length read %d", read_len);
|
||||||
if (parse_oid_hex(hex_hash, &oid, &end) || *end != '\n')
|
if (parse_oid_hex_algop(hex_hash, &oid, &end, r->hash_algo) || *end != '\n')
|
||||||
die("invalid hash");
|
die("invalid hash");
|
||||||
oid_array_append(commons, &oid);
|
oid_array_append(commons, &oid);
|
||||||
} while (1);
|
} while (1);
|
||||||
@@ -480,7 +482,8 @@ static void get_commons_through_negotiation(const char *url,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int send_pack(struct send_pack_args *args,
|
int send_pack(struct repository *r,
|
||||||
|
struct send_pack_args *args,
|
||||||
int fd[], struct child_process *conn,
|
int fd[], struct child_process *conn,
|
||||||
struct ref *remote_refs,
|
struct ref *remote_refs,
|
||||||
struct oid_array *extra_have)
|
struct oid_array *extra_have)
|
||||||
@@ -518,17 +521,17 @@ int send_pack(struct send_pack_args *args,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
git_config_get_bool("push.negotiate", &push_negotiate);
|
repo_config_get_bool(r, "push.negotiate", &push_negotiate);
|
||||||
if (push_negotiate) {
|
if (push_negotiate) {
|
||||||
trace2_region_enter("send_pack", "push_negotiate", the_repository);
|
trace2_region_enter("send_pack", "push_negotiate", r);
|
||||||
get_commons_through_negotiation(args->url, remote_refs, &commons);
|
get_commons_through_negotiation(r, args->url, remote_refs, &commons);
|
||||||
trace2_region_leave("send_pack", "push_negotiate", the_repository);
|
trace2_region_leave("send_pack", "push_negotiate", r);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!git_config_get_bool("push.usebitmaps", &use_bitmaps))
|
if (!repo_config_get_bool(r, "push.usebitmaps", &use_bitmaps))
|
||||||
args->disable_bitmaps = !use_bitmaps;
|
args->disable_bitmaps = !use_bitmaps;
|
||||||
|
|
||||||
git_config_get_bool("transfer.advertisesid", &advertise_sid);
|
repo_config_get_bool(r, "transfer.advertisesid", &advertise_sid);
|
||||||
|
|
||||||
/* Does the other end support the reporting? */
|
/* Does the other end support the reporting? */
|
||||||
if (server_supports("report-status-v2"))
|
if (server_supports("report-status-v2"))
|
||||||
@@ -554,7 +557,7 @@ int send_pack(struct send_pack_args *args,
|
|||||||
if (server_supports("push-options"))
|
if (server_supports("push-options"))
|
||||||
push_options_supported = 1;
|
push_options_supported = 1;
|
||||||
|
|
||||||
if (!server_supports_hash(the_hash_algo->name, &object_format_supported))
|
if (!server_supports_hash(r->hash_algo->name, &object_format_supported))
|
||||||
die(_("the receiving end does not support this repository's hash algorithm"));
|
die(_("the receiving end does not support this repository's hash algorithm"));
|
||||||
|
|
||||||
if (args->push_cert != SEND_PACK_PUSH_CERT_NEVER) {
|
if (args->push_cert != SEND_PACK_PUSH_CERT_NEVER) {
|
||||||
@@ -596,7 +599,7 @@ int send_pack(struct send_pack_args *args,
|
|||||||
if (use_push_options)
|
if (use_push_options)
|
||||||
strbuf_addstr(&cap_buf, " push-options");
|
strbuf_addstr(&cap_buf, " push-options");
|
||||||
if (object_format_supported)
|
if (object_format_supported)
|
||||||
strbuf_addf(&cap_buf, " object-format=%s", the_hash_algo->name);
|
strbuf_addf(&cap_buf, " object-format=%s", r->hash_algo->name);
|
||||||
if (agent_supported)
|
if (agent_supported)
|
||||||
strbuf_addf(&cap_buf, " agent=%s", git_user_agent_sanitized());
|
strbuf_addf(&cap_buf, " agent=%s", git_user_agent_sanitized());
|
||||||
if (advertise_sid)
|
if (advertise_sid)
|
||||||
@@ -646,7 +649,7 @@ int send_pack(struct send_pack_args *args,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!args->dry_run)
|
if (!args->dry_run)
|
||||||
advertise_shallow_grafts_buf(&req_buf);
|
advertise_shallow_grafts_buf(r, &req_buf);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Finally, tell the other end!
|
* Finally, tell the other end!
|
||||||
@@ -686,7 +689,7 @@ int send_pack(struct send_pack_args *args,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (args->stateless_rpc) {
|
if (args->stateless_rpc) {
|
||||||
if (!args->dry_run && (cmds_sent || is_repository_shallow(the_repository))) {
|
if (!args->dry_run && (cmds_sent || is_repository_shallow(r))) {
|
||||||
packet_buf_flush(&req_buf);
|
packet_buf_flush(&req_buf);
|
||||||
send_sideband(out, -1, req_buf.buf, req_buf.len, LARGE_PACKET_MAX);
|
send_sideband(out, -1, req_buf.buf, req_buf.len, LARGE_PACKET_MAX);
|
||||||
}
|
}
|
||||||
@@ -711,7 +714,7 @@ int send_pack(struct send_pack_args *args,
|
|||||||
PACKET_READ_DIE_ON_ERR_PACKET);
|
PACKET_READ_DIE_ON_ERR_PACKET);
|
||||||
|
|
||||||
if (need_pack_data && cmds_sent) {
|
if (need_pack_data && cmds_sent) {
|
||||||
if (pack_objects(out, remote_refs, extra_have, &commons, args) < 0) {
|
if (pack_objects(r, out, remote_refs, extra_have, &commons, args) < 0) {
|
||||||
if (args->stateless_rpc)
|
if (args->stateless_rpc)
|
||||||
close(out);
|
close(out);
|
||||||
if (git_connection_is_socket(conn))
|
if (git_connection_is_socket(conn))
|
||||||
@@ -724,7 +727,7 @@ int send_pack(struct send_pack_args *args,
|
|||||||
* we get one).
|
* we get one).
|
||||||
*/
|
*/
|
||||||
if (status_report)
|
if (status_report)
|
||||||
receive_status(&reader, remote_refs);
|
receive_status(r, &reader, remote_refs);
|
||||||
|
|
||||||
if (use_sideband) {
|
if (use_sideband) {
|
||||||
close(demux.out);
|
close(demux.out);
|
||||||
@@ -743,7 +746,7 @@ int send_pack(struct send_pack_args *args,
|
|||||||
packet_flush(out);
|
packet_flush(out);
|
||||||
|
|
||||||
if (status_report && cmds_sent)
|
if (status_report && cmds_sent)
|
||||||
ret = receive_status(&reader, remote_refs);
|
ret = receive_status(r, &reader, remote_refs);
|
||||||
else
|
else
|
||||||
ret = 0;
|
ret = 0;
|
||||||
if (args->stateless_rpc)
|
if (args->stateless_rpc)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
struct child_process;
|
struct child_process;
|
||||||
struct oid_array;
|
struct oid_array;
|
||||||
struct ref;
|
struct ref;
|
||||||
|
struct repository;
|
||||||
|
|
||||||
/* Possible values for push_cert field in send_pack_args. */
|
/* Possible values for push_cert field in send_pack_args. */
|
||||||
#define SEND_PACK_PUSH_CERT_NEVER 0
|
#define SEND_PACK_PUSH_CERT_NEVER 0
|
||||||
@@ -35,7 +36,7 @@ struct option;
|
|||||||
int option_parse_push_signed(const struct option *opt,
|
int option_parse_push_signed(const struct option *opt,
|
||||||
const char *arg, int unset);
|
const char *arg, int unset);
|
||||||
|
|
||||||
int send_pack(struct send_pack_args *args,
|
int send_pack(struct repository *r, struct send_pack_args *args,
|
||||||
int fd[], struct child_process *conn,
|
int fd[], struct child_process *conn,
|
||||||
struct ref *remote_refs, struct oid_array *extra_have);
|
struct ref *remote_refs, struct oid_array *extra_have);
|
||||||
|
|
||||||
|
|||||||
36
serve.c
36
serve.c
@@ -1,5 +1,3 @@
|
|||||||
#define USE_THE_REPOSITORY_VARIABLE
|
|
||||||
|
|
||||||
#include "git-compat-util.h"
|
#include "git-compat-util.h"
|
||||||
#include "repository.h"
|
#include "repository.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@@ -159,7 +157,7 @@ static struct protocol_capability capabilities[] = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
void protocol_v2_advertise_capabilities(void)
|
void protocol_v2_advertise_capabilities(struct repository *r)
|
||||||
{
|
{
|
||||||
struct strbuf capability = STRBUF_INIT;
|
struct strbuf capability = STRBUF_INIT;
|
||||||
struct strbuf value = STRBUF_INIT;
|
struct strbuf value = STRBUF_INIT;
|
||||||
@@ -170,7 +168,7 @@ void protocol_v2_advertise_capabilities(void)
|
|||||||
for (size_t i = 0; i < ARRAY_SIZE(capabilities); i++) {
|
for (size_t i = 0; i < ARRAY_SIZE(capabilities); i++) {
|
||||||
struct protocol_capability *c = &capabilities[i];
|
struct protocol_capability *c = &capabilities[i];
|
||||||
|
|
||||||
if (c->advertise(the_repository, &value)) {
|
if (c->advertise(r, &value)) {
|
||||||
strbuf_addstr(&capability, c->name);
|
strbuf_addstr(&capability, c->name);
|
||||||
|
|
||||||
if (value.len) {
|
if (value.len) {
|
||||||
@@ -214,20 +212,20 @@ static struct protocol_capability *get_capability(const char *key, const char **
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int receive_client_capability(const char *key)
|
static int receive_client_capability(struct repository *r, const char *key)
|
||||||
{
|
{
|
||||||
const char *value;
|
const char *value;
|
||||||
const struct protocol_capability *c = get_capability(key, &value);
|
const struct protocol_capability *c = get_capability(key, &value);
|
||||||
|
|
||||||
if (!c || c->command || !c->advertise(the_repository, NULL))
|
if (!c || c->command || !c->advertise(r, NULL))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (c->receive)
|
if (c->receive)
|
||||||
c->receive(the_repository, value);
|
c->receive(r, value);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parse_command(const char *key, struct protocol_capability **command)
|
static int parse_command(struct repository *r, const char *key, struct protocol_capability **command)
|
||||||
{
|
{
|
||||||
const char *out;
|
const char *out;
|
||||||
|
|
||||||
@@ -238,7 +236,7 @@ static int parse_command(const char *key, struct protocol_capability **command)
|
|||||||
if (*command)
|
if (*command)
|
||||||
die("command '%s' requested after already requesting command '%s'",
|
die("command '%s' requested after already requesting command '%s'",
|
||||||
out, (*command)->name);
|
out, (*command)->name);
|
||||||
if (!cmd || !cmd->advertise(the_repository, NULL) || !cmd->command || value)
|
if (!cmd || !cmd->advertise(r, NULL) || !cmd->command || value)
|
||||||
die("invalid command '%s'", out);
|
die("invalid command '%s'", out);
|
||||||
|
|
||||||
*command = cmd;
|
*command = cmd;
|
||||||
@@ -253,7 +251,7 @@ enum request_state {
|
|||||||
PROCESS_REQUEST_DONE,
|
PROCESS_REQUEST_DONE,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int process_request(void)
|
static int process_request(struct repository *r)
|
||||||
{
|
{
|
||||||
enum request_state state = PROCESS_REQUEST_KEYS;
|
enum request_state state = PROCESS_REQUEST_KEYS;
|
||||||
struct packet_reader reader;
|
struct packet_reader reader;
|
||||||
@@ -278,8 +276,8 @@ static int process_request(void)
|
|||||||
case PACKET_READ_EOF:
|
case PACKET_READ_EOF:
|
||||||
BUG("Should have already died when seeing EOF");
|
BUG("Should have already died when seeing EOF");
|
||||||
case PACKET_READ_NORMAL:
|
case PACKET_READ_NORMAL:
|
||||||
if (parse_command(reader.line, &command) ||
|
if (parse_command(r, reader.line, &command) ||
|
||||||
receive_client_capability(reader.line))
|
receive_client_capability(r, reader.line))
|
||||||
seen_capability_or_command = 1;
|
seen_capability_or_command = 1;
|
||||||
else
|
else
|
||||||
die("unknown capability '%s'", reader.line);
|
die("unknown capability '%s'", reader.line);
|
||||||
@@ -319,30 +317,30 @@ static int process_request(void)
|
|||||||
if (!command)
|
if (!command)
|
||||||
die("no command requested");
|
die("no command requested");
|
||||||
|
|
||||||
if (client_hash_algo != hash_algo_by_ptr(the_repository->hash_algo))
|
if (client_hash_algo != hash_algo_by_ptr(r->hash_algo))
|
||||||
die("mismatched object format: server %s; client %s",
|
die("mismatched object format: server %s; client %s",
|
||||||
the_repository->hash_algo->name,
|
r->hash_algo->name,
|
||||||
hash_algos[client_hash_algo].name);
|
hash_algos[client_hash_algo].name);
|
||||||
|
|
||||||
command->command(the_repository, &reader);
|
command->command(r, &reader);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void protocol_v2_serve_loop(int stateless_rpc)
|
void protocol_v2_serve_loop(struct repository *r, int stateless_rpc)
|
||||||
{
|
{
|
||||||
if (!stateless_rpc)
|
if (!stateless_rpc)
|
||||||
protocol_v2_advertise_capabilities();
|
protocol_v2_advertise_capabilities(r);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If stateless-rpc was requested then exit after
|
* If stateless-rpc was requested then exit after
|
||||||
* a single request/response exchange
|
* a single request/response exchange
|
||||||
*/
|
*/
|
||||||
if (stateless_rpc) {
|
if (stateless_rpc) {
|
||||||
process_request();
|
process_request(r);
|
||||||
} else {
|
} else {
|
||||||
for (;;)
|
for (;;)
|
||||||
if (process_request())
|
if (process_request(r))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
6
serve.h
6
serve.h
@@ -1,7 +1,9 @@
|
|||||||
#ifndef SERVE_H
|
#ifndef SERVE_H
|
||||||
#define SERVE_H
|
#define SERVE_H
|
||||||
|
|
||||||
void protocol_v2_advertise_capabilities(void);
|
struct repository;
|
||||||
void protocol_v2_serve_loop(int stateless_rpc);
|
|
||||||
|
void protocol_v2_advertise_capabilities(struct repository *r);
|
||||||
|
void protocol_v2_serve_loop(struct repository *r, int stateless_rpc);
|
||||||
|
|
||||||
#endif /* SERVE_H */
|
#endif /* SERVE_H */
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#define USE_THE_REPOSITORY_VARIABLE
|
|
||||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||||
|
|
||||||
#include "git-compat-util.h"
|
#include "git-compat-util.h"
|
||||||
@@ -18,6 +17,7 @@
|
|||||||
#include "tempfile.h"
|
#include "tempfile.h"
|
||||||
|
|
||||||
struct update_info_ctx {
|
struct update_info_ctx {
|
||||||
|
struct repository *repo;
|
||||||
FILE *cur_fp;
|
FILE *cur_fp;
|
||||||
FILE *old_fp; /* becomes NULL if it differs from cur_fp */
|
FILE *old_fp; /* becomes NULL if it differs from cur_fp */
|
||||||
struct strbuf cur_sb;
|
struct strbuf cur_sb;
|
||||||
@@ -73,7 +73,7 @@ static int uic_printf(struct update_info_ctx *uic, const char *fmt, ...)
|
|||||||
* it into place. The contents of the file come from "generate", which
|
* it into place. The contents of the file come from "generate", which
|
||||||
* should return non-zero if it encounters an error.
|
* should return non-zero if it encounters an error.
|
||||||
*/
|
*/
|
||||||
static int update_info_file(char *path,
|
static int update_info_file(struct repository *r, char *path,
|
||||||
int (*generate)(struct update_info_ctx *),
|
int (*generate)(struct update_info_ctx *),
|
||||||
int force)
|
int force)
|
||||||
{
|
{
|
||||||
@@ -81,6 +81,7 @@ static int update_info_file(char *path,
|
|||||||
struct tempfile *f = NULL;
|
struct tempfile *f = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
struct update_info_ctx uic = {
|
struct update_info_ctx uic = {
|
||||||
|
.repo = r,
|
||||||
.cur_fp = NULL,
|
.cur_fp = NULL,
|
||||||
.old_fp = NULL,
|
.old_fp = NULL,
|
||||||
.cur_sb = STRBUF_INIT,
|
.cur_sb = STRBUF_INIT,
|
||||||
@@ -152,7 +153,7 @@ static int add_info_ref(const char *path, const char *referent UNUSED, const str
|
|||||||
void *cb_data)
|
void *cb_data)
|
||||||
{
|
{
|
||||||
struct update_info_ctx *uic = cb_data;
|
struct update_info_ctx *uic = cb_data;
|
||||||
struct object *o = parse_object(the_repository, oid);
|
struct object *o = parse_object(uic->repo, oid);
|
||||||
if (!o)
|
if (!o)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@@ -160,7 +161,7 @@ static int add_info_ref(const char *path, const char *referent UNUSED, const str
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (o->type == OBJ_TAG) {
|
if (o->type == OBJ_TAG) {
|
||||||
o = deref_tag(the_repository, o, path, 0);
|
o = deref_tag(uic->repo, o, path, 0);
|
||||||
if (o)
|
if (o)
|
||||||
if (uic_printf(uic, "%s %s^{}\n",
|
if (uic_printf(uic, "%s %s^{}\n",
|
||||||
oid_to_hex(&o->oid), path) < 0)
|
oid_to_hex(&o->oid), path) < 0)
|
||||||
@@ -171,14 +172,14 @@ static int add_info_ref(const char *path, const char *referent UNUSED, const str
|
|||||||
|
|
||||||
static int generate_info_refs(struct update_info_ctx *uic)
|
static int generate_info_refs(struct update_info_ctx *uic)
|
||||||
{
|
{
|
||||||
return refs_for_each_ref(get_main_ref_store(the_repository),
|
return refs_for_each_ref(get_main_ref_store(uic->repo),
|
||||||
add_info_ref, uic);
|
add_info_ref, uic);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int update_info_refs(int force)
|
static int update_info_refs(struct repository *r, int force)
|
||||||
{
|
{
|
||||||
char *path = git_pathdup("info/refs");
|
char *path = repo_git_path(r, "info/refs");
|
||||||
int ret = update_info_file(path, generate_info_refs, force);
|
int ret = update_info_file(r, path, generate_info_refs, force);
|
||||||
free(path);
|
free(path);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -284,14 +285,14 @@ static int compare_info(const void *a_, const void *b_)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_pack_info(const char *infofile, int force)
|
static void init_pack_info(struct repository *r, const char *infofile, int force)
|
||||||
{
|
{
|
||||||
struct packed_git *p;
|
struct packed_git *p;
|
||||||
int stale;
|
int stale;
|
||||||
int i;
|
int i;
|
||||||
size_t alloc = 0;
|
size_t alloc = 0;
|
||||||
|
|
||||||
for (p = get_all_packs(the_repository); p; p = p->next) {
|
for (p = get_all_packs(r); p; p = p->next) {
|
||||||
/* we ignore things on alternate path since they are
|
/* we ignore things on alternate path since they are
|
||||||
* not available to the pullers in general.
|
* not available to the pullers in general.
|
||||||
*/
|
*/
|
||||||
@@ -340,33 +341,36 @@ static int write_pack_info_file(struct update_info_ctx *uic)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int update_info_packs(int force)
|
static int update_info_packs(struct repository *r, int force)
|
||||||
{
|
{
|
||||||
char *infofile = mkpathdup("%s/info/packs",
|
char *infofile = mkpathdup("%s/info/packs",
|
||||||
repo_get_object_directory(the_repository));
|
repo_get_object_directory(r));
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
init_pack_info(infofile, force);
|
init_pack_info(r, infofile, force);
|
||||||
ret = update_info_file(infofile, write_pack_info_file, force);
|
ret = update_info_file(r, infofile, write_pack_info_file, force);
|
||||||
free_pack_info();
|
free_pack_info();
|
||||||
free(infofile);
|
free(infofile);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* public */
|
/* public */
|
||||||
int update_server_info(int force)
|
int update_server_info(struct repository *r, int force)
|
||||||
{
|
{
|
||||||
/* We would add more dumb-server support files later,
|
/* We would add more dumb-server support files later,
|
||||||
* including index of available pack files and their
|
* including index of available pack files and their
|
||||||
* intended audiences.
|
* intended audiences.
|
||||||
*/
|
*/
|
||||||
int errs = 0;
|
int errs = 0;
|
||||||
|
char *path;
|
||||||
|
|
||||||
errs = errs | update_info_refs(force);
|
errs = errs | update_info_refs(r, force);
|
||||||
errs = errs | update_info_packs(force);
|
errs = errs | update_info_packs(r, force);
|
||||||
|
|
||||||
/* remove leftover rev-cache file if there is any */
|
/* remove leftover rev-cache file if there is any */
|
||||||
unlink_or_warn(git_path("info/rev-cache"));
|
path = repo_git_path(r, "info/rev-cache");
|
||||||
|
unlink_or_warn(path);
|
||||||
|
free(path);
|
||||||
|
|
||||||
return errs;
|
return errs;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
#ifndef SERVER_INFO_H
|
#ifndef SERVER_INFO_H
|
||||||
#define SERVER_INFO_H
|
#define SERVER_INFO_H
|
||||||
|
|
||||||
|
struct repository;
|
||||||
|
|
||||||
/* Dumb servers support */
|
/* Dumb servers support */
|
||||||
int update_server_info(int);
|
int update_server_info(struct repository *r, int force);
|
||||||
|
|
||||||
#endif /* SERVER_INFO_H */
|
#endif /* SERVER_INFO_H */
|
||||||
|
|||||||
@@ -17,10 +17,14 @@
|
|||||||
*
|
*
|
||||||
* See 't0500-progress-display.sh' for examples.
|
* See 't0500-progress-display.sh' for examples.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define USE_THE_REPOSITORY_VARIABLE
|
||||||
#define GIT_TEST_PROGRESS_ONLY
|
#define GIT_TEST_PROGRESS_ONLY
|
||||||
|
|
||||||
#include "test-tool.h"
|
#include "test-tool.h"
|
||||||
#include "parse-options.h"
|
#include "parse-options.h"
|
||||||
#include "progress.h"
|
#include "progress.h"
|
||||||
|
#include "repository.h"
|
||||||
#include "strbuf.h"
|
#include "strbuf.h"
|
||||||
#include "string-list.h"
|
#include "string-list.h"
|
||||||
|
|
||||||
@@ -64,7 +68,7 @@ int cmd__progress(int argc, const char **argv)
|
|||||||
else
|
else
|
||||||
die("invalid input: '%s'", line.buf);
|
die("invalid input: '%s'", line.buf);
|
||||||
|
|
||||||
progress = start_progress(title, total);
|
progress = start_progress(the_repository, title, total);
|
||||||
} else if (skip_prefix(line.buf, "progress ", (const char **) &end)) {
|
} else if (skip_prefix(line.buf, "progress ", (const char **) &end)) {
|
||||||
uint64_t item_count = strtoull(end, &end, 10);
|
uint64_t item_count = strtoull(end, &end, 10);
|
||||||
if (*end != '\0')
|
if (*end != '\0')
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
|
#define USE_THE_REPOSITORY_VARIABLE
|
||||||
|
|
||||||
#include "test-tool.h"
|
#include "test-tool.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "parse-options.h"
|
#include "parse-options.h"
|
||||||
|
#include "repository.h"
|
||||||
#include "serve.h"
|
#include "serve.h"
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
|
|
||||||
@@ -28,9 +31,9 @@ int cmd__serve_v2(int argc, const char **argv)
|
|||||||
PARSE_OPT_KEEP_UNKNOWN_OPT);
|
PARSE_OPT_KEEP_UNKNOWN_OPT);
|
||||||
|
|
||||||
if (advertise_capabilities)
|
if (advertise_capabilities)
|
||||||
protocol_v2_advertise_capabilities();
|
protocol_v2_advertise_capabilities(the_repository);
|
||||||
else
|
else
|
||||||
protocol_v2_serve_loop(stateless_rpc);
|
protocol_v2_serve_loop(the_repository, stateless_rpc);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
15
tmp-objdir.c
15
tmp-objdir.c
@@ -1,5 +1,3 @@
|
|||||||
#define USE_THE_REPOSITORY_VARIABLE
|
|
||||||
|
|
||||||
#include "git-compat-util.h"
|
#include "git-compat-util.h"
|
||||||
#include "tmp-objdir.h"
|
#include "tmp-objdir.h"
|
||||||
#include "abspath.h"
|
#include "abspath.h"
|
||||||
@@ -16,6 +14,7 @@
|
|||||||
#include "repository.h"
|
#include "repository.h"
|
||||||
|
|
||||||
struct tmp_objdir {
|
struct tmp_objdir {
|
||||||
|
struct repository *repo;
|
||||||
struct strbuf path;
|
struct strbuf path;
|
||||||
struct strvec env;
|
struct strvec env;
|
||||||
struct object_directory *prev_odb;
|
struct object_directory *prev_odb;
|
||||||
@@ -116,7 +115,8 @@ static int setup_tmp_objdir(const char *root)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tmp_objdir *tmp_objdir_create(const char *prefix)
|
struct tmp_objdir *tmp_objdir_create(struct repository *r,
|
||||||
|
const char *prefix)
|
||||||
{
|
{
|
||||||
static int installed_handlers;
|
static int installed_handlers;
|
||||||
struct tmp_objdir *t;
|
struct tmp_objdir *t;
|
||||||
@@ -125,6 +125,7 @@ struct tmp_objdir *tmp_objdir_create(const char *prefix)
|
|||||||
BUG("only one tmp_objdir can be used at a time");
|
BUG("only one tmp_objdir can be used at a time");
|
||||||
|
|
||||||
t = xcalloc(1, sizeof(*t));
|
t = xcalloc(1, sizeof(*t));
|
||||||
|
t->repo = r;
|
||||||
strbuf_init(&t->path, 0);
|
strbuf_init(&t->path, 0);
|
||||||
strvec_init(&t->env);
|
strvec_init(&t->env);
|
||||||
|
|
||||||
@@ -134,7 +135,7 @@ struct tmp_objdir *tmp_objdir_create(const char *prefix)
|
|||||||
* them.
|
* them.
|
||||||
*/
|
*/
|
||||||
strbuf_addf(&t->path, "%s/tmp_objdir-%s-XXXXXX",
|
strbuf_addf(&t->path, "%s/tmp_objdir-%s-XXXXXX",
|
||||||
repo_get_object_directory(the_repository), prefix);
|
repo_get_object_directory(r), prefix);
|
||||||
|
|
||||||
if (!mkdtemp(t->path.buf)) {
|
if (!mkdtemp(t->path.buf)) {
|
||||||
/* free, not destroy, as we never touched the filesystem */
|
/* free, not destroy, as we never touched the filesystem */
|
||||||
@@ -154,7 +155,7 @@ struct tmp_objdir *tmp_objdir_create(const char *prefix)
|
|||||||
}
|
}
|
||||||
|
|
||||||
env_append(&t->env, ALTERNATE_DB_ENVIRONMENT,
|
env_append(&t->env, ALTERNATE_DB_ENVIRONMENT,
|
||||||
absolute_path(repo_get_object_directory(the_repository)));
|
absolute_path(repo_get_object_directory(r)));
|
||||||
env_replace(&t->env, DB_ENVIRONMENT, absolute_path(t->path.buf));
|
env_replace(&t->env, DB_ENVIRONMENT, absolute_path(t->path.buf));
|
||||||
env_replace(&t->env, GIT_QUARANTINE_ENVIRONMENT,
|
env_replace(&t->env, GIT_QUARANTINE_ENVIRONMENT,
|
||||||
absolute_path(t->path.buf));
|
absolute_path(t->path.buf));
|
||||||
@@ -273,14 +274,14 @@ int tmp_objdir_migrate(struct tmp_objdir *t)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (t->prev_odb) {
|
if (t->prev_odb) {
|
||||||
if (the_repository->objects->odb->will_destroy)
|
if (t->repo->objects->odb->will_destroy)
|
||||||
BUG("migrating an ODB that was marked for destruction");
|
BUG("migrating an ODB that was marked for destruction");
|
||||||
restore_primary_odb(t->prev_odb, t->path.buf);
|
restore_primary_odb(t->prev_odb, t->path.buf);
|
||||||
t->prev_odb = NULL;
|
t->prev_odb = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
strbuf_addbuf(&src, &t->path);
|
strbuf_addbuf(&src, &t->path);
|
||||||
strbuf_addstr(&dst, repo_get_object_directory(the_repository));
|
strbuf_addstr(&dst, repo_get_object_directory(t->repo));
|
||||||
|
|
||||||
ret = migrate_paths(&src, &dst, 0);
|
ret = migrate_paths(&src, &dst, 0);
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
* Example:
|
* Example:
|
||||||
*
|
*
|
||||||
* struct child_process child = CHILD_PROCESS_INIT;
|
* struct child_process child = CHILD_PROCESS_INIT;
|
||||||
* struct tmp_objdir *t = tmp_objdir_create("incoming");
|
* struct tmp_objdir *t = tmp_objdir_create(repo, "incoming");
|
||||||
* strvec_push(&child.args, cmd);
|
* strvec_push(&child.args, cmd);
|
||||||
* strvec_pushv(&child.env, tmp_objdir_env(t));
|
* strvec_pushv(&child.env, tmp_objdir_env(t));
|
||||||
* if (!run_command(&child)) && !tmp_objdir_migrate(t))
|
* if (!run_command(&child)) && !tmp_objdir_migrate(t))
|
||||||
@@ -21,13 +21,14 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
struct repository;
|
||||||
struct tmp_objdir;
|
struct tmp_objdir;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a new temporary object directory with the specified prefix;
|
* Create a new temporary object directory with the specified prefix;
|
||||||
* returns NULL on failure.
|
* returns NULL on failure.
|
||||||
*/
|
*/
|
||||||
struct tmp_objdir *tmp_objdir_create(const char *prefix);
|
struct tmp_objdir *tmp_objdir_create(struct repository *r, const char *prefix);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return a list of environment strings, suitable for use with
|
* Return a list of environment strings, suitable for use with
|
||||||
|
|||||||
9
trace.c
9
trace.c
@@ -21,7 +21,6 @@
|
|||||||
* along with this program; if not, see <https://www.gnu.org/licenses/>.
|
* along with this program; if not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define USE_THE_REPOSITORY_VARIABLE
|
|
||||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||||
|
|
||||||
#include "git-compat-util.h"
|
#include "git-compat-util.h"
|
||||||
@@ -298,7 +297,7 @@ static const char *quote_crnl(const char *path)
|
|||||||
return new_path.buf;
|
return new_path.buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void trace_repo_setup(void)
|
void trace_repo_setup(struct repository *r)
|
||||||
{
|
{
|
||||||
const char *git_work_tree, *prefix = startup_info->prefix;
|
const char *git_work_tree, *prefix = startup_info->prefix;
|
||||||
char *cwd;
|
char *cwd;
|
||||||
@@ -308,14 +307,14 @@ void trace_repo_setup(void)
|
|||||||
|
|
||||||
cwd = xgetcwd();
|
cwd = xgetcwd();
|
||||||
|
|
||||||
if (!(git_work_tree = repo_get_work_tree(the_repository)))
|
if (!(git_work_tree = repo_get_work_tree(r)))
|
||||||
git_work_tree = "(null)";
|
git_work_tree = "(null)";
|
||||||
|
|
||||||
if (!startup_info->prefix)
|
if (!startup_info->prefix)
|
||||||
prefix = "(null)";
|
prefix = "(null)";
|
||||||
|
|
||||||
trace_printf_key(&trace_setup_key, "setup: git_dir: %s\n", quote_crnl(repo_get_git_dir(the_repository)));
|
trace_printf_key(&trace_setup_key, "setup: git_dir: %s\n", quote_crnl(repo_get_git_dir(r)));
|
||||||
trace_printf_key(&trace_setup_key, "setup: git_common_dir: %s\n", quote_crnl(repo_get_common_dir(the_repository)));
|
trace_printf_key(&trace_setup_key, "setup: git_common_dir: %s\n", quote_crnl(repo_get_common_dir(r)));
|
||||||
trace_printf_key(&trace_setup_key, "setup: worktree: %s\n", quote_crnl(git_work_tree));
|
trace_printf_key(&trace_setup_key, "setup: worktree: %s\n", quote_crnl(git_work_tree));
|
||||||
trace_printf_key(&trace_setup_key, "setup: cwd: %s\n", quote_crnl(cwd));
|
trace_printf_key(&trace_setup_key, "setup: cwd: %s\n", quote_crnl(cwd));
|
||||||
trace_printf_key(&trace_setup_key, "setup: prefix: %s\n", quote_crnl(prefix));
|
trace_printf_key(&trace_setup_key, "setup: prefix: %s\n", quote_crnl(prefix));
|
||||||
|
|||||||
4
trace.h
4
trace.h
@@ -92,7 +92,9 @@ extern struct trace_key trace_default_key;
|
|||||||
extern struct trace_key trace_perf_key;
|
extern struct trace_key trace_perf_key;
|
||||||
extern struct trace_key trace_setup_key;
|
extern struct trace_key trace_setup_key;
|
||||||
|
|
||||||
void trace_repo_setup(void);
|
struct repository;
|
||||||
|
|
||||||
|
void trace_repo_setup(struct repository *r);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the trace key is enabled. Used to prevent expensive
|
* Checks whether the trace key is enabled. Used to prevent expensive
|
||||||
|
|||||||
@@ -932,7 +932,7 @@ static int git_transport_push(struct transport *transport, struct ref *remote_re
|
|||||||
break;
|
break;
|
||||||
case protocol_v1:
|
case protocol_v1:
|
||||||
case protocol_v0:
|
case protocol_v0:
|
||||||
ret = send_pack(&args, data->fd, data->conn, remote_refs,
|
ret = send_pack(the_repository, &args, data->fd, data->conn, remote_refs,
|
||||||
&data->extra_have);
|
&data->extra_have);
|
||||||
break;
|
break;
|
||||||
case protocol_unknown_version:
|
case protocol_unknown_version:
|
||||||
|
|||||||
@@ -372,7 +372,8 @@ static struct progress *get_progress(struct unpack_trees_options *o,
|
|||||||
total++;
|
total++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return start_delayed_progress(_("Updating files"), total);
|
return start_delayed_progress(the_repository,
|
||||||
|
_("Updating files"), total);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setup_collided_checkout_detection(struct checkout *state,
|
static void setup_collided_checkout_detection(struct checkout *state,
|
||||||
@@ -1773,6 +1774,7 @@ static int clear_ce_flags(struct index_state *istate,
|
|||||||
strbuf_reset(&prefix);
|
strbuf_reset(&prefix);
|
||||||
if (show_progress)
|
if (show_progress)
|
||||||
istate->progress = start_delayed_progress(
|
istate->progress = start_delayed_progress(
|
||||||
|
the_repository,
|
||||||
_("Updating index flags"),
|
_("Updating index flags"),
|
||||||
istate->cache_nr);
|
istate->cache_nr);
|
||||||
|
|
||||||
|
|||||||
3
walker.c
3
walker.c
@@ -172,7 +172,8 @@ static int loop(struct walker *walker)
|
|||||||
uint64_t nr = 0;
|
uint64_t nr = 0;
|
||||||
|
|
||||||
if (walker->get_progress)
|
if (walker->get_progress)
|
||||||
progress = start_delayed_progress(_("Fetching objects"), 0);
|
progress = start_delayed_progress(the_repository,
|
||||||
|
_("Fetching objects"), 0);
|
||||||
|
|
||||||
while (process_queue) {
|
while (process_queue) {
|
||||||
struct object *obj = process_queue->item;
|
struct object *obj = process_queue->item;
|
||||||
|
|||||||
Reference in New Issue
Block a user