Merge branch 'jk/repo-init-cleanup'

Further clean-up of the initialization code.

* jk/repo-init-cleanup:
  config: stop checking whether the_repository is NULL
  common-main: delay trace2 initialization
  t1309: use short branch name in includeIf.onbranch test
This commit is contained in:
Junio C Hamano 2019-09-09 12:26:35 -07:00
commit b4a1eec332
3 changed files with 11 additions and 6 deletions

View File

@ -39,16 +39,16 @@ int main(int argc, const char **argv)
git_resolve_executable_dir(argv[0]);
trace2_initialize();
trace2_cmd_start(argv);
trace2_collect_process_info(TRACE2_PROCESS_INFO_STARTUP);
git_setup_gettext();
initialize_the_repository();
attr_start();
trace2_initialize();
trace2_cmd_start(argv);
trace2_collect_process_info(TRACE2_PROCESS_INFO_STARTUP);
result = cmd_main(argc, argv);
trace2_cmd_exit(result);

View File

@ -275,7 +275,7 @@ static int include_by_branch(const char *cond, size_t cond_len)
int flags;
int ret;
struct strbuf pattern = STRBUF_INIT;
const char *refname = !the_repository || !the_repository->gitdir ?
const char *refname = !the_repository->gitdir ?
NULL : resolve_ref_unsafe("HEAD", 0, NULL, &flags);
const char *shortname;

View File

@ -91,7 +91,12 @@ test_expect_failure 'ignore .git/ with invalid config' '
test_expect_success 'early config and onbranch' '
echo "[broken" >broken &&
test_with_config "[includeif \"onbranch:refs/heads/master\"]path=../broken"
test_with_config "[includeif \"onbranch:master\"]path=../broken"
'
test_expect_success 'onbranch config outside of git repo' '
test_config_global includeIf.onbranch:master.path non-existent &&
nongit git help
'
test_done