Re: [PATCH v5 4/4] init: provide useful advice about init.defaultBranch
- From
SZEDER Gábor <szeder.dev@gmail.com>
- Date
- Feb 2, 2021, 21:24 UTC
- Message-ID
- <20210202212451.GC2091@szeder.dev>
- In-Reply-To
- <ce26446b1a2e7bf14cdf814ca56c37b2e7d6b578.1607686618.git.gitgitgadget@gmail.com>
On Fri, Dec 11, 2020 at 11:36:57AM +0000, Johannes Schindelin via GitGitGadget wrote:
Show 15 quoted lines
> From: Johannes Schindelin <johannes.schindelin@gmx.de> > > To give ample warning for users wishing to override Git's the fall-back > for an unconfigured `init.defaultBranch` (in case we decide to change it > in a future Git version), let's introduce some advice that is shown upon > `git init` when that value is not set. > > Note: two test cases in Git's test suite want to verify that the > `stderr` output of `git init` is empty. It is now necessary to suppress > the advice, we now do that via the `init.defaultBranch` setting. While > not strictly necessary, we also set this to `false` in > `test_create_repo()`. > > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> > ---
Show 13 quoted lines
> diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
> index 59bbf75e832..9910102ae1f 100644
> --- a/t/test-lib-functions.sh
> +++ b/t/test-lib-functions.sh
> @@ -1202,7 +1202,9 @@ test_create_repo () {
> mkdir -p "$repo"
> (
> cd "$repo" || error "Cannot setup test environment"
> - "${GIT_TEST_INSTALLED:-$GIT_EXEC_PATH}/git$X" init \
> + "${GIT_TEST_INSTALLED:-$GIT_EXEC_PATH}/git$X" -c \
> + init.defaultBranch="${GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME-master}" \
> + init \
> "--template=$GIT_BUILD_DIR/templates/blt/" >&3 2>&4 ||This breaks GIT_TEST_INSTALLED when the given Git version doesn't yet contain 8b1fa77867 (Allow passing of configuration parameters in the command line, 2010-03-26):
$ GIT_TEST_INSTALLED=.../v1.6.0/bin/ ./t9999-test.sh -x Unknown option: -c usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS] error: cannot run git init -- have you built things yet?
> error "cannot run git init -- have you built things yet?" > mv .git/hooks .git/hooks-disabled > -- > gitgitgadget