Skip to content

Commit b4a1eec

Browse files
committed
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
2 parents 70336bd + 22932d9 commit b4a1eec

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

common-main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ int main(int argc, const char **argv)
3939

4040
git_resolve_executable_dir(argv[0]);
4141

42-
trace2_initialize();
43-
trace2_cmd_start(argv);
44-
trace2_collect_process_info(TRACE2_PROCESS_INFO_STARTUP);
45-
4642
git_setup_gettext();
4743

4844
initialize_the_repository();
4945

5046
attr_start();
5147

48+
trace2_initialize();
49+
trace2_cmd_start(argv);
50+
trace2_collect_process_info(TRACE2_PROCESS_INFO_STARTUP);
51+
5252
result = cmd_main(argc, argv);
5353

5454
trace2_cmd_exit(result);

config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ static int include_by_branch(const char *cond, size_t cond_len)
275275
int flags;
276276
int ret;
277277
struct strbuf pattern = STRBUF_INIT;
278-
const char *refname = !the_repository || !the_repository->gitdir ?
278+
const char *refname = !the_repository->gitdir ?
279279
NULL : resolve_ref_unsafe("HEAD", 0, NULL, &flags);
280280
const char *shortname;
281281

t/t1309-early-config.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,12 @@ test_expect_failure 'ignore .git/ with invalid config' '
9191

9292
test_expect_success 'early config and onbranch' '
9393
echo "[broken" >broken &&
94-
test_with_config "[includeif \"onbranch:refs/heads/master\"]path=../broken"
94+
test_with_config "[includeif \"onbranch:master\"]path=../broken"
95+
'
96+
97+
test_expect_success 'onbranch config outside of git repo' '
98+
test_config_global includeIf.onbranch:master.path non-existent &&
99+
nongit git help
95100
'
96101

97102
test_done

0 commit comments

Comments
 (0)