Re: [PATCH 1/9] init: allow overriding the default branch name for new repositories
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Jun 10, 2020, 23:22 UTC
- Message-ID
- <20200610232246.GT6569@camp.crustytoothpaste.net>
- In-Reply-To
- <90912e32da1192cfc3b39a18cb606caa46e85b1c.1591823971.git.gitgitgadget@gmail.com>
On 2020-06-10 at 21:19:22, Don Goodman-Wilson via GitGitGadget wrote:
> + /* prepend "refs/heads/" to the branch name */
> + prefixed = xstrfmt("refs/heads/%s", branch_name);
> + if (check_refname_format(prefixed, 0))
> + die(_("invalid default branch name: '%s'"), branch_name);I'm glad to see this part and a check for it in the test below. We wouldn't want a typo to create a broken branch name.
Show 6 quoted lines
> +test_expect_success 'invalid custom default branch name' ' > + test_must_fail env GIT_TEST_DEFAULT_BRANCH_NAME="with space" \ > + git init custom-invalid 2>err && > + test_i18ngrep "invalid default branch name" err > +' > +
-- brian m. carlson: Houston, Texas, US OpenPGP: https://keybase.io/bk2204