On Sun, Sep 22, 2024 at 02:51:34PM +0800, shejialuo wrote: [snip] > However, the repo does not exist, so we cannot find any ref backend. The > main problem is that we never check whether "the_repository->gitdir" is > a git directory in "config.c::include_by_branch". So, we do not need to > check the value of the option "--git-dir". > I have just scanned the recent code here, because Patrick has already replaced the "the_repository", there is no problem here when set up the configuration in the TOT. The code will first check whether the "data->repo" is NULL. However, there is still a problem after setup: #5 0x0000555555780442 in ref_store_init (repo=0x555555948b00 <the_repo>, format=<optimized out>, gitdir=<optimized out>, flags=15) at refs.c:1938 #6 ref_store_init (repo=0x555555948b00 <the_repo>, format=<optimized out>, gitdir=<optimized out>, flags=15) at refs.c:1928 #7 get_main_ref_store (r=0x555555948b00 <the_repo>) at refs.c:1958 #8 0x00005555556a332d in include_by_branch (data=0x7fffffffd400, cond=0x555555953d13 "main.path", cond_len=4) at config.c:308 #9 include_condition_is_true (kvi=0x7fffffffd320, inc=0x7fffffffd400, cond=0x555555953d13 "main.path", cond_len=4) at config.c:408 #10 git_config_include (var=var@entry=0x555555953d00 "includeif.onbranch:main.path", value=value@entry=0x55555595382f "notexist", ctx=ctx@entry=0x7fffffffd280, data=data@entry=0x7fffffffd400) at config.c:438 #11 0x000055555569d3a3 in config_parse_pair (key=<optimized out>, value=0x55555595382f "notexist", kvi=kvi@entry=0x7fffffffd320, fn=fn@entry=0x5555556a3060 <git_config_include>, data=data@entry=0x7fffffffd400) at config.c:616 #12 0x000055555569dafd in parse_config_env_list ( env=0x555555953810 "includeIf.onbranch:main.path", kvi=0x7fffffffd320, fn=0x5555556a3060 <git_config_include>, data=0x7fffffffd400) at config.c:699 #13 git_config_from_parameters (fn=fn@entry=0x5555556a3060 <git_config_include>, data=data@entry=0x7fffffffd400) at config.c:772 #14 0x000055555569e383 in do_git_config_sequence (opts=0x7fffffffd550, repo=repo@entry=0x555555948b00 <the_repo>, fn=fn@entry=0x5555556a3060 <git_config_include>, data=data@entry=0x7fffffffd400) at config.c:2131 #15 0x000055555569ed49 in config_with_options (fn=0x5555556a3060 <git_config_include>, data=0x7fffffffd400, config_source=<optimized out>, repo=0x555555948b00 <the_repo>, opts=<optimized out>) at config.c:2174 #16 0x000055555569eec7 in repo_read_config (repo=0x555555948b00 <the_repo>) at config.c:2544 #17 git_config_check_init (repo=repo@entry=0x555555948b00 <the_repo>) at config.c:2564 #18 0x00005555556a0272 in repo_config (repo=0x555555948b00 <the_repo>, fn=fn@entry=0x5555558218a0 <git_tar_config>, data=data@entry=0x0) at config.c:2576 #19 0x0000555555822651 in git_config (fn=0x5555558218a0 <git_tar_config>, data=0x0) at /home/shejialuo/Projects/git/config.h:704 #20 init_tar_archiver () at archive-tar.c:544 #21 0x00005555556700c9 in init_archivers () at archive.c:46 #22 0x000055555557f8b8 in cmd_archive (argc=2, argv=0x7fffffffdcc8, prefix=0x0) at builtin/archive.c:98 #23 0x00005555555753c9 in run_builtin (p=0x555555916760 <commands+96>, argc=2, argv=0x7fffffffdcc8) at git.c:483 #24 handle_builtin (argc=2, argv=0x7fffffffdcc8) at git.c:739 #25 0x0000555555576335 in run_argv (argcp=argcp@entry=0x7ffff It still uses the old "git_config", so we still have a problem when we explicitly specify the "--git-dir". However, once Patrick replaces all the "the_repository", this bug should never exist. So, I won't dive into this. Thanks, Jialuo