Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trace2: A few final fixups from upstream/master targeting 2.22.0-RC #139

Merged
merged 4 commits into from
May 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -1690,12 +1690,14 @@ static int do_git_config_sequence(const struct config_options *opts,

current_parsing_scope = CONFIG_SCOPE_SYSTEM;
if (git_config_system()) {
unsigned flag = opts->system_gently ? ACCESS_EACCES_OK : 0;

if (git_program_data_config() &&
!access_or_die(git_program_data_config(), R_OK, 0))
!access_or_die(git_program_data_config(), R_OK, flag))
ret += git_config_from_file(fn,
git_program_data_config(),
data);
if (!access_or_die(git_etc_gitconfig(), R_OK, 0))
if (!access_or_die(git_etc_gitconfig(), R_OK, flag))
ret += git_config_from_file(fn, git_etc_gitconfig(),
data);
}
Expand Down Expand Up @@ -1827,6 +1829,7 @@ void read_very_early_config(config_fn_t cb, void *data)
opts.ignore_repo = 1;
opts.ignore_worktree = 1;
opts.ignore_cmdline = 1;
opts.system_gently = 1;

config_with_options(cb, data, NULL, &opts);
}
Expand Down
1 change: 1 addition & 0 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ struct config_options {
unsigned int ignore_repo : 1;
unsigned int ignore_worktree : 1;
unsigned int ignore_cmdline : 1;
unsigned int system_gently : 1;
const char *commondir;
const char *git_dir;
config_parser_event_fn_t event_fn;
Expand Down
2 changes: 1 addition & 1 deletion read-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -3146,7 +3146,7 @@ static int write_shared_index(struct index_state *istate,
trace2_region_enter_printf("index", "shared/do_write_index",
the_repository, "%s", (*temp)->filename.buf);
ret = do_write_index(si->base, *temp, 1);
trace2_region_enter_printf("index", "shared/do_write_index",
trace2_region_leave_printf("index", "shared/do_write_index",
the_repository, "%s", (*temp)->filename.buf);

if (ret)
Expand Down
17 changes: 12 additions & 5 deletions trace2.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,10 +565,14 @@ void trace2_region_enter_printf_va_fl(const char *file, int line,
}

void trace2_region_enter_fl(const char *file, int line, const char *category,
const char *label, const struct repository *repo)
const char *label, const struct repository *repo, ...)
{
va_list ap;
va_start(ap, repo);
trace2_region_enter_printf_va_fl(file, line, category, label, repo,
NULL, NULL);
NULL, ap);
va_end(ap);

}

void trace2_region_enter_printf_fl(const char *file, int line,
Expand Down Expand Up @@ -638,10 +642,13 @@ void trace2_region_leave_printf_va_fl(const char *file, int line,
}

void trace2_region_leave_fl(const char *file, int line, const char *category,
const char *label, const struct repository *repo)
const char *label, const struct repository *repo, ...)
{
va_list ap;
va_start(ap, repo);
trace2_region_leave_printf_va_fl(file, line, category, label, repo,
NULL, NULL);
NULL, ap);
va_end(ap);
}

void trace2_region_leave_printf_fl(const char *file, int line,
Expand Down Expand Up @@ -727,7 +734,7 @@ void trace2_data_json_fl(const char *file, int line, const char *category,
us_elapsed_region = tr2tls_region_elasped_self(us_now);

for_each_wanted_builtin (j, tgt_j)
if (tgt_j->pfn_data_fl)
if (tgt_j->pfn_data_json_fl)
tgt_j->pfn_data_json_fl(file, line, us_elapsed_absolute,
us_elapsed_region, category,
repo, key, value);
Expand Down
4 changes: 2 additions & 2 deletions trace2.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ void trace2_def_repo_fl(const char *file, int line, struct repository *repo);
* on this thread.
*/
void trace2_region_enter_fl(const char *file, int line, const char *category,
const char *label, const struct repository *repo);
const char *label, const struct repository *repo, ...);

#define trace2_region_enter(category, label, repo) \
trace2_region_enter_fl(__FILE__, __LINE__, (category), (label), (repo))
Expand Down Expand Up @@ -297,7 +297,7 @@ void trace2_region_enter_printf(const char *category, const char *label,
* in this nesting level.
*/
void trace2_region_leave_fl(const char *file, int line, const char *category,
const char *label, const struct repository *repo);
const char *label, const struct repository *repo, ...);

#define trace2_region_leave(category, label, repo) \
trace2_region_leave_fl(__FILE__, __LINE__, (category), (label), (repo))
Expand Down
2 changes: 1 addition & 1 deletion trace2/tr2_tgt_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ static void fn_atexit(uint64_t us_elapsed_absolute, int code)
static void maybe_add_string_va(struct json_writer *jw, const char *field_name,
const char *fmt, va_list ap)
{
if (fmt && *fmt && ap) {
if (fmt && *fmt) {
va_list copy_ap;
struct strbuf buf = STRBUF_INIT;

Expand Down
2 changes: 1 addition & 1 deletion trace2/tr2_tgt_normal.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ static void fn_atexit(uint64_t us_elapsed_absolute, int code)
static void maybe_append_string_va(struct strbuf *buf, const char *fmt,
va_list ap)
{
if (fmt && *fmt && ap) {
if (fmt && *fmt) {
va_list copy_ap;

va_copy(copy_ap, ap);
Expand Down
2 changes: 1 addition & 1 deletion trace2/tr2_tgt_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ static void fn_atexit(uint64_t us_elapsed_absolute, int code)
static void maybe_append_string_va(struct strbuf *buf, const char *fmt,
va_list ap)
{
if (fmt && *fmt && ap) {
if (fmt && *fmt) {
va_list copy_ap;

va_copy(copy_ap, ap);
Expand Down