checkout/fetch/pull/pack-objects: allow -h outside a repository again
cover checkout/fetch/pull/pack-objects: allow -h outside a repository again
As reported in https://github.com/git-for-windows/git/issues/3688, calling git fetch -h outside a repository now results in a very ugly
BUG: repo-settings.c:23: Cannot add settings for uninitialized repository
The reason is that the prepare_repo_settings() calls (that we introduced to support sparse index) assume that there is a gitdir, but the hack to allow parse_options() to handle -h even outside a repository invalidates that assumption.
One strategy I considered was to move the prepare_repo_settings() calls after parse_options(). This would work because when parse_options() handles -h, it exits without returning.
However, this strategy failed in my tests because e.g. cmd_unpack_objects() does need the pack_use_sparse to be populated correctly before even parsing the options so that it can be overridden via --sparse/--no-sparse.
Hence the current strategy where the code that prepares the repo settings and then accesses them is guarded behind the condition that we must have a gitdir to do so.
Note: There are other instances where prepare_repo_settings() is called before parse_options(), e.g. in cmd_status(), in seen there are even more instances (e.g. cmd_checkout_index()). All of those instances that are not touched by this here patch do have special code to handle -h early, though, before calling prepare_repo_settings() let alone parse_options().
Johannes Schindelin (2):
checkout/fetch/pull/pack-objects: allow -h outside a repository
t0012: verify that built-ins handle -h even without gitdir
builtin/checkout.c | 7 ++++--- builtin/fetch.c | 7 +++++-- builtin/pack-objects.c | 8 +++++--- builtin/pull.c | 6 ++++-- t/t0012-help.sh | 7 ++++++- 5 files changed, 24 insertions(+), 11 deletions(-)
base-commit: 4c53a8c20f8984adb226293a3ffd7b88c3f4ac1a
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1139%2Fdscho%2Fprepare_repo_settings-after-parse_options-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1139/dscho/prepare_repo_settings-after-parse_options-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1139
Signature · 1 line
gitgitgadget
PATCH 1/2 checkout/fetch/pull/pack-objects: allow `-h` outside a repository
From: Johannes Schindelin <[email protected]>
When we taught these commands about the sparse index, we did not account for the fact that the cmd_*() functions _can_ be called without a gitdir, namely when -h is passed to show the usage.
A plausible approach to address this is to move the prepare_repo_settings() calls right after the parse_options() calls:
The latter will never return when it handles -h, and therefore it is safe to assume that we have a gitdir at that point, as long as the built-in is marked with the RUN_SETUP flag.
However, it is unfortunately not that simple. In cmd_pack_objects(), for example, the repo settings need to be fully populated so that the command-line options --sparse/--no-sparse can override them, not the other way round.
Therefore, we choose to imitate the strategy taken in cmd_diff(), where we simply do not bother to prepare and initialize the repo settings unless we have a gitdir.
This fixes https://github.com/git-for-windows/git/issues/3688
--- builtin/checkout.c | 7 ++++--- builtin/fetch.c | 7 +++++-- builtin/pack-objects.c | 8 +++++--- builtin/pull.c | 6 ++++-- 4 files changed, 18 insertions(+), 10 deletions(-)
builtin/checkout.c +4 -3
@@ -1602,9 +1602,10 @@ static int checkout_main(int argc, const char **argv, const char *prefix, opts->show_progress =-1 ;git_config (git_checkout_config, opts); - -prepare_repo_settings (the_repository); - the_repository->settings.command_requires_full_index =0 ; +if (the_repository->gitdir) { +prepare_repo_settings (the_repository); + the_repository->settings.command_requires_full_index =0 ; + } opts->track =BRANCH_TRACK_UNSPECIFIED ;
builtin/fetch.c +5 -2
@@ -2014,11 +2014,14 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) }git_config (git_fetch_config,NULL ); -prepare_repo_settings (the_repository); - the_repository->settings.command_requires_full_index =0 ; +if (the_repository->gitdir) { +prepare_repo_settings (the_repository); + the_repository->settings.command_requires_full_index =0 ; + } argc =parse_options (argc, argv, prefix, builtin_fetch_options, builtin_fetch_usage,0 ); +if (recurse_submodules !=RECURSE_SUBMODULES_OFF ) {int *sfjc = submodule_fetch_jobs_config ==-1 ? &submodule_fetch_jobs_config :NULL ;
builtin/pack-objects.c +5 -3
@@ -3976,9 +3976,11 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) read_replace_refs =0 ; sparse =git_env_bool ("GIT_TEST_PACK_SPARSE" ,-1 ); -prepare_repo_settings (the_repository); -if (sparse <0 ) - sparse = the_repository->settings.pack_use_sparse; +if (the_repository->gitdir) { +prepare_repo_settings (the_repository); +if (sparse <0 ) + sparse = the_repository->settings.pack_use_sparse; + }reset_pack_idx_option (&pack_idx_opts);git_config (git_pack_config,NULL );
builtin/pull.c +4 -2
@@ -994,8 +994,10 @@ int cmd_pull(int argc, const char **argv, const char *prefix)set_reflog_message (argc, argv);git_config (git_pull_config,NULL ); -prepare_repo_settings (the_repository); - the_repository->settings.command_requires_full_index =0 ; +if (the_repository->gitdir) { +prepare_repo_settings (the_repository); + the_repository->settings.command_requires_full_index =0 ; + } argc =parse_options (argc, argv, prefix, pull_options, pull_usage,0 );
Signature · 1 line
gitgitgadget
Re: [PATCH 1/2] checkout/fetch/pull/pack-objects: allow `-h` outside a repository
"Johannes Schindelin via GitGitGadget" <[email protected]>
Quoted 17 lines · writes:
From: Johannes Schindelin <[email protected]>
When we taught these commands about the sparse index, we did not account for the fact that the
cmd_*()functions _can_ be called without a gitdir, namely when-his passed to show the usage.A plausible approach to address this is to move the
prepare_repo_settings()calls right after theparse_options()calls:
The latter will never return when it handles-h, and therefore it is safe to assume that we have agitdirat that point, as long as the built-in is marked with theRUN_SETUPflag.However, it is unfortunately not that simple. In
cmd_pack_objects(), for example, the repo settings need to be fully populated so that the command-line options--sparse/--no-sparsecan override them, not the other way round.
Quoted 8 lines
Therefore, we choose to imitate the strategy taken in
cmd_diff(), where we simply do not bother to prepare and initialize the repo settings unless we have agitdir.This fixes https://github.com/git-for-windows/git/issues/3688
Signed-off-by Johannes Schindelin <[email protected]>---
These "prepare" calls are always tricky. This somehow reminds me of 44c7e62e (repo-settings: prepare_repo_settings only in git repos, 2021-12-06) and e5b17bda (git: ensure correct git directory setup with -h, 2021-12-06), which were part of the ld/sparse-diff-blame topic that was merged at 8d2c3732 during the last cycle.
Quoted 5 lines
builtin/checkout.c +0
-0
builtin/checkout.c static int checkout_main(int argc, const char **argv, const char *prefix, · line 1608
Quoted 10 lines
builtin/checkout.c +4
-3@@ -1602,9 +1602,10 @@ static int checkout_main(int argc, const char **argv, const char *prefix, opts->show_progress =-1 ;git_config (git_checkout_config, opts); - -prepare_repo_settings (the_repository); - the_repository->settings.command_requires_full_index =0 ; +if (the_repository->gitdir) { +prepare_repo_settings (the_repository); + the_repository->settings.command_requires_full_index =0 ; + }
Looks quite straight-forward and sensible. Of course, the checkout command will go berserk and do nonsense if it is allowed to proceed much further from here without .gitdir, but we know that
(1) the only case where .gitdir is NULL at this point is when running "-h" from outside a repository (we would have done a full RUN_SETUP without demoting it to RUN_SETUP_GENTLY if we weren't doing "-h"), and that
(2) this is soon followed by parse_options() where it notices "-h" and stops.
so skipping "prepare" outside a repository is totally safe.
Quoted 5 lines
builtin/fetch.c +0
-0
builtin/fetch.c int cmd_fetch(int argc, const char **argv, const char *prefix) · line 2020
Quoted 9 lines
builtin/fetch.c +4
-2@@ -2014,11 +2014,14 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) }git_config (git_fetch_config,NULL ); -prepare_repo_settings (the_repository); - the_repository->settings.command_requires_full_index =0 ; +if (the_repository->gitdir) { +prepare_repo_settings (the_repository); + the_repository->settings.command_requires_full_index =0 ; + }
Ditto.
builtin/fetch.c int cmd_fetch(int argc, const char **argv, const char *prefix) · line 2025
Quoted 4 lines
builtin/fetch.c +1
-0argc =parse_options (argc, argv, prefix, builtin_fetch_options, builtin_fetch_usage,0 ); +if (recurse_submodules !=RECURSE_SUBMODULES_OFF ) {
Unrelated blank line?
Quoted 11 lines
builtin/fetch.c +0
-0int *sfjc = submodule_fetch_jobs_config ==-1 ? &submodule_fetch_jobs_config :NULL ;builtin/pack-objects.c +0
-1@@ -3976,9 +3976,11 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) read_replace_refs =0 ; sparse =git_env_bool ("GIT_TEST_PACK_SPARSE" ,-1 ); -prepare_repo_settings (the_repository);
builtin/pack-objects.c int cmd_pack_objects(int argc, const char **argv, const char *prefix) · line 3986
Quoted 10 lines
builtin/pack-objects.c +5
-2-if (sparse <0 ) - sparse = the_repository->settings.pack_use_sparse; +if (the_repository->gitdir) { +prepare_repo_settings (the_repository); +if (sparse <0 ) + sparse = the_repository->settings.pack_use_sparse; + }reset_pack_idx_option (&pack_idx_opts);git_config (git_pack_config,NULL );
This has a bit more sequence of calls until it reaches parse_options(), but their side effect, when run outside a repository, are all benign in-core effects, so this is safe, too.
Quoted 16 lines
builtin/pull.c +4
-2@@ -994,8 +994,10 @@ int cmd_pull(int argc, const char **argv, const char *prefix)set_reflog_message (argc, argv);git_config (git_pull_config,NULL ); -prepare_repo_settings (the_repository); - the_repository->settings.command_requires_full_index =0 ; +if (the_repository->gitdir) { +prepare_repo_settings (the_repository); + the_repository->settings.command_requires_full_index =0 ; + } argc =parse_options (argc, argv, prefix, pull_options, pull_usage,0 );
Re: [PATCH 1/2] checkout/fetch/pull/pack-objects: allow `-h` outside a repository
Hi Junio,
Quoted 26 lines · Junio C Hamano
"Johannes Schindelin via GitGitGadget" <[email protected]>
Quoted 23 lines · writes:
From: Johannes Schindelin <[email protected]>
When we taught these commands about the sparse index, we did not account for the fact that the
cmd_*()functions _can_ be called without a gitdir, namely when-his passed to show the usage.A plausible approach to address this is to move the
prepare_repo_settings()calls right after theparse_options()calls:
The latter will never return when it handles-h, and therefore it is safe to assume that we have agitdirat that point, as long as the built-in is marked with theRUN_SETUPflag.However, it is unfortunately not that simple. In
cmd_pack_objects(), for example, the repo settings need to be fully populated so that the command-line options--sparse/--no-sparsecan override them, not the other way round.Therefore, we choose to imitate the strategy taken in
cmd_diff(), where we simply do not bother to prepare and initialize the repo settings unless we have agitdir.This fixes https://github.com/git-for-windows/git/issues/3688
Quoted 8 lines
Quoted 2 lines
Signed-off-by Johannes Schindelin <[email protected]>---
These "prepare" calls are always tricky. This somehow reminds me of
44c7e62e(repo-settings:prepare_repo_settingsonly in git repos, 2021-12-06) ande5b17bda(git: ensure correct git directory setup with -h, 2021-12-06), which were part of the ld/sparse-diff-blame topic that was merged at8d2c3732during the last cycle.
Yes, and I did indeed imitate the way Lessley changed cmd_diff(). It turned out to be much smarter than the first approach I tried (and that I described as a "plausible approach" in the commit message).
Quoted 25 lines
Quoted 5 lines
builtin/checkout.c +0
-0builtin/checkout.c static int checkout_main(int argc, const char **argv, const char *prefix, · line 1608
Quoted 10 lines
builtin/checkout.c +4
-3@@ -1602,9 +1602,10 @@ static int checkout_main(int argc, const char **argv, const char *prefix, opts->show_progress =-1 ;git_config (git_checkout_config, opts); - -prepare_repo_settings (the_repository); - the_repository->settings.command_requires_full_index =0 ; +if (the_repository->gitdir) { +prepare_repo_settings (the_repository); + the_repository->settings.command_requires_full_index =0 ; + }Looks quite straight-forward and sensible. Of course, the checkout command will go berserk and do nonsense if it is allowed to proceed much further from here without .gitdir, but we know that
(1) the only case where .gitdir is NULL at this point is when running "-h" from outside a repository (we would have done a full
RUN_SETUPwithout demoting it toRUN_SETUP_GENTLYif we weren't doing "-h"), and that
Quoted 4 lines
(2) this is soon followed by
parse_options()where it notices "-h" and stops.so skipping "prepare" outside a repository is totally safe.
Indeed.
Plus, do not forget how the second patch in this series ensures that there are no other calls that would get the hiccups when gitdir is NULL.
Quoted 17 lines
Quoted 5 lines
builtin/fetch.c +0
-0builtin/fetch.c int cmd_fetch(int argc, const char **argv, const char *prefix) · line 2020
Quoted 9 lines
builtin/fetch.c +4
-2@@ -2014,11 +2014,14 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) }git_config (git_fetch_config,NULL ); -prepare_repo_settings (the_repository); - the_repository->settings.command_requires_full_index =0 ; +if (the_repository->gitdir) { +prepare_repo_settings (the_repository); + the_repository->settings.command_requires_full_index =0 ; + }Ditto.
Quoted 6 lines
builtin/fetch.c int cmd_fetch(int argc, const char **argv, const char *prefix) · line 2025
Quoted 4 lines
builtin/fetch.c +1
-0argc =parse_options (argc, argv, prefix, builtin_fetch_options, builtin_fetch_usage,0 ); +if (recurse_submodules !=RECURSE_SUBMODULES_OFF ) {Unrelated blank line?
Whoops, yes. I did mention that I first tried to move the call, right? That's a left-over from not _completely_ cleaning up after that failed attempt.
Quoted 20 lines
Quoted 20 lines
builtin/fetch.c +0
-0int *sfjc = submodule_fetch_jobs_config ==-1 ? &submodule_fetch_jobs_config :NULL ;builtin/pack-objects.c +5
-3@@ -3976,9 +3976,11 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) read_replace_refs =0 ; sparse =git_env_bool ("GIT_TEST_PACK_SPARSE" ,-1 ); -prepare_repo_settings (the_repository); -if (sparse <0 ) - sparse = the_repository->settings.pack_use_sparse; +if (the_repository->gitdir) { +prepare_repo_settings (the_repository); +if (sparse <0 ) + sparse = the_repository->settings.pack_use_sparse; + }
Quoted 6 lines
builtin/pack-objects.c int cmd_pack_objects(int argc, const char **argv, const char *prefix) · line 3986
Quoted 2 lines
builtin/pack-objects.c +0
-0reset_pack_idx_option (&pack_idx_opts);git_config (git_pack_config,NULL );This has a bit more sequence of calls until it reaches
parse_options(), but their side effect, when run outside a repository, are all benign in-core effects, so this is safe, too.
And once again, I would like to point out that the regression test is crucial to keep this benign.
I'll send out v2 shortly.
Ciao,
Dscho
Quoted 18 lines
Quoted 17 lines
builtin/pull.c +4
-2@@ -994,8 +994,10 @@ int cmd_pull(int argc, const char **argv, const char *prefix)set_reflog_message (argc, argv);git_config (git_pull_config,NULL ); -prepare_repo_settings (the_repository); - the_repository->settings.command_requires_full_index =0 ; +if (the_repository->gitdir) { +prepare_repo_settings (the_repository); + the_repository->settings.command_requires_full_index =0 ; + } argc =parse_options (argc, argv, prefix, pull_options, pull_usage,0 );
PATCH 2/2 t0012: verify that built-ins handle `-h` even without gitdir
In reply to Johannes Schindelin via GitGitGadgetFrom: Johannes Schindelin <[email protected]>
We just fixed a class of recently introduced bugs where calling, say, git fetch -h outside a repository would not show the usage but instead show an ugly BUG message.
Let's verify that this does not regress anymore.
--- t/t0012-help.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
t/t0012-help.sh +6 -1
@@ -139,13 +139,18 @@ test_expect_success 'git help --config-sections-for-completion' ' ' test_expect_success 'generate builtin list' ' + mkdir -p sub && git --list-cmds=builtins >builtins ' while read builtin do test_expect_success "$builtin can handle -h" ' - test_expect_code 129 git $builtin -h >output 2>&1 && + ( + GIT_CEILING_DIRECTORIES=$(pwd) && + export GIT_CEILING_DIRECTORIES && + test_expect_code 129 git -C sub $builtin -h >output 2>&1 + ) && test_i18ngrep usage output ' done <builtins
Signature · 1 line
gitgitgadget
v2 cover checkout/fetch/pull/pack-objects: allow -h outside a repository again
In reply to Johannes Schindelin via GitGitGadgetAs reported in https://github.com/git-for-windows/git/issues/3688, calling git fetch -h outside a repository now results in a very ugly
BUG: repo-settings.c:23: Cannot add settings for uninitialized repository
The reason is that the prepare_repo_settings() calls (that we introduced to support sparse index) assume that there is a gitdir, but the hack to allow parse_options() to handle -h even outside a repository invalidates that assumption.
One strategy I considered was to move the prepare_repo_settings() calls after parse_options(). This would work because when parse_options() handles -h, it exits without returning.
However, this strategy failed in my tests because e.g. cmd_unpack_objects() does need the pack_use_sparse to be populated correctly before even parsing the options so that it can be overridden via --sparse/--no-sparse.
Hence the current strategy where the code that prepares the repo settings and then accesses them is guarded behind the condition that we must have a gitdir to do so.
Note: There are other instances where prepare_repo_settings() is called before parse_options(), e.g. in cmd_status(), in seen there are even more instances (e.g. cmd_checkout_index()). All of those instances that are not touched by this here patch do have special code to handle -h early, though, before calling prepare_repo_settings() let alone parse_options().
Johannes Schindelin (2):
checkout/fetch/pull/pack-objects: allow -h outside a repository
t0012: verify that built-ins handle -h even without gitdir
builtin/checkout.c | 7 ++++--- builtin/fetch.c | 6 ++++-- builtin/pack-objects.c | 8 +++++--- builtin/pull.c | 6 ++++-- t/t0012-help.sh | 7 ++++++- 5 files changed, 23 insertions(+), 11 deletions(-)
base-commit: 4c53a8c20f8984adb226293a3ffd7b88c3f4ac1a
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1139%2Fdscho%2Fprepare_repo_settings-after-parse_options-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1139/dscho/prepare_repo_settings-after-parse_options-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/1139
Range-diff vs v1:
1: 25d1a2963f2 ! 1: 6e9cdd10a70 checkout/fetch/pull/pack-objects: allow -h outside a repository
@@ builtin/fetch.c: int cmd_fetch(int argc, const char **argv, const char *prefix)
argc = parse_options(argc, argv, prefix,
builtin_fetch_options, builtin_fetch_usage, 0);
-+
- if (recurse_submodules != RECURSE_SUBMODULES_OFF) {
- int *sfjc = submodule_fetch_jobs_config == -1
- ? &submodule_fetch_jobs_config : NULL;
## builtin/pack-objects.c ##
@@ builtin/pack-objects.c: int cmd_pack_objects(int argc, const char **argv, const char *prefix)
2: 49977ff9f4e = 2: 93df4a73dab t0012: verify that built-ins handle -h even without gitdir
Signature · 1 line
gitgitgadget
PATCH v2 1/2 checkout/fetch/pull/pack-objects: allow `-h` outside a repository
From: Johannes Schindelin <[email protected]>
When we taught these commands about the sparse index, we did not account for the fact that the cmd_*() functions _can_ be called without a gitdir, namely when -h is passed to show the usage.
A plausible approach to address this is to move the prepare_repo_settings() calls right after the parse_options() calls:
The latter will never return when it handles -h, and therefore it is safe to assume that we have a gitdir at that point, as long as the built-in is marked with the RUN_SETUP flag.
However, it is unfortunately not that simple. In cmd_pack_objects(), for example, the repo settings need to be fully populated so that the command-line options --sparse/--no-sparse can override them, not the other way round.
Therefore, we choose to imitate the strategy taken in cmd_diff(), where we simply do not bother to prepare and initialize the repo settings unless we have a gitdir.
This fixes https://github.com/git-for-windows/git/issues/3688
--- builtin/checkout.c | 7 ++++--- builtin/fetch.c | 6 ++++-- builtin/pack-objects.c | 8 +++++--- builtin/pull.c | 6 ++++-- 4 files changed, 17 insertions(+), 10 deletions(-)
builtin/checkout.c +4 -3
@@ -1602,9 +1602,10 @@ static int checkout_main(int argc, const char **argv, const char *prefix, opts->show_progress =-1 ;git_config (git_checkout_config, opts); - -prepare_repo_settings (the_repository); - the_repository->settings.command_requires_full_index =0 ; +if (the_repository->gitdir) { +prepare_repo_settings (the_repository); + the_repository->settings.command_requires_full_index =0 ; + } opts->track =BRANCH_TRACK_UNSPECIFIED ;
builtin/fetch.c +4 -2
@@ -2014,8 +2014,10 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) }git_config (git_fetch_config,NULL ); -prepare_repo_settings (the_repository); - the_repository->settings.command_requires_full_index =0 ; +if (the_repository->gitdir) { +prepare_repo_settings (the_repository); + the_repository->settings.command_requires_full_index =0 ; + } argc =parse_options (argc, argv, prefix, builtin_fetch_options, builtin_fetch_usage,0 );
builtin/pack-objects.c +5 -3
@@ -3976,9 +3976,11 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) read_replace_refs =0 ; sparse =git_env_bool ("GIT_TEST_PACK_SPARSE" ,-1 ); -prepare_repo_settings (the_repository); -if (sparse <0 ) - sparse = the_repository->settings.pack_use_sparse; +if (the_repository->gitdir) { +prepare_repo_settings (the_repository); +if (sparse <0 ) + sparse = the_repository->settings.pack_use_sparse; + }reset_pack_idx_option (&pack_idx_opts);git_config (git_pack_config,NULL );
builtin/pull.c +4 -2
@@ -994,8 +994,10 @@ int cmd_pull(int argc, const char **argv, const char *prefix)set_reflog_message (argc, argv);git_config (git_pull_config,NULL ); -prepare_repo_settings (the_repository); - the_repository->settings.command_requires_full_index =0 ; +if (the_repository->gitdir) { +prepare_repo_settings (the_repository); + the_repository->settings.command_requires_full_index =0 ; + } argc =parse_options (argc, argv, prefix, pull_options, pull_usage,0 );
Signature · 1 line
gitgitgadget
PATCH v2 2/2 t0012: verify that built-ins handle `-h` even without gitdir
In reply to Johannes Schindelin via GitGitGadgetFrom: Johannes Schindelin <[email protected]>
We just fixed a class of recently introduced bugs where calling, say, git fetch -h outside a repository would not show the usage but instead show an ugly BUG message.
Let's verify that this does not regress anymore.
--- t/t0012-help.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
t/t0012-help.sh +6 -1
@@ -139,13 +139,18 @@ test_expect_success 'git help --config-sections-for-completion' ' ' test_expect_success 'generate builtin list' ' + mkdir -p sub && git --list-cmds=builtins >builtins ' while read builtin do test_expect_success "$builtin can handle -h" ' - test_expect_code 129 git $builtin -h >output 2>&1 && + ( + GIT_CEILING_DIRECTORIES=$(pwd) && + export GIT_CEILING_DIRECTORIES && + test_expect_code 129 git -C sub $builtin -h >output 2>&1 + ) && test_i18ngrep usage output ' done <builtins
Signature · 1 line
gitgitgadget