git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org,
	Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Subject: Re: [PATCH] t4013: prepare for the new default branch name "main"
Date: Thu, 12 Nov 2020 08:50:08 -0800	[thread overview]
Message-ID: <xmqqwnyqjz9b.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <nycvar.QRO.7.76.6.2011121443100.18437@tvgsbejvaqbjf.bet> (Johannes Schindelin's message of "Thu, 12 Nov 2020 14:48:36 +0100 (CET)")

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> Unfortunately not because at that stage, `HOME` is still not overridden.
> It will be overridden in `test-lib.sh`. Which is also where the initial
> repository (and hence, the initial branch) will be created.
>
> So: the suggested command with work neither before `. test-lib.sh` nor
> after it.

Why doesn't it work after it?

Ahh, the top-level test repository at $TRASH_DIRECTORY may have
already been created with an unborn branch that is 'main'---but we
can easily rename it to a hardcoded value that the rest of the test
wants to see with just a little bit of code (see below).

> What's wrong with the test cases in t0001-init.sh ...

They are not wrong at all.  I am only saying there is no reason to
declare that no tests other than them are allowed to test with
different branch name.

But it seems that we do not even have to muck with $HOME/.gitconfig
or the configuration variable, as t4013 happily stays in the
initially created repository and conducts its various tests, without
creating secondary repositories.  What matters is on which branch
that Initial commit gets created in the 'setup' step.

Something along this line, but except the first two commented-out
commands that I added when testing manually without an updated
version of Git whose default is already changed to 'main', would
unbreak the tests, no?

 t/t4013-diff-various.sh | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git c/t/t4013-diff-various.sh w/t/t4013-diff-various.sh
index f72d456d3b..b37e1e04cc 100755
--- c/t/t4013-diff-various.sh
+++ w/t/t4013-diff-various.sh
@@ -8,8 +8,23 @@ test_description='Various diff formatting options'
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/diff-lib.sh
 
+# git symbolic-ref HEAD refs/heads/main
+# git config init.defaultbranch main
+
 test_expect_success setup '
 
+	# Since there are too many references of "master" in the
+	# golden-master that output from the test commands is
+	# compared against, we fix (not in the sense to "correct",
+	# but in the sense to "make unmovable") the choice made
+	# in this test repository to use the historical branch name
+	# to avoid churning the test and affect in-flight topics.
+	git symbolic-ref HEAD refs/heads/master &&
+
+	# Just in case---we do not create separate repositories in
+	# this test, so it should not make any difference.
+	git config --global init.defaultbranch master &&
+
 	GIT_AUTHOR_DATE="2006-06-26 00:00:00 +0000" &&
 	GIT_COMMITTER_DATE="2006-06-26 00:00:00 +0000" &&
 	export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&

      reply	other threads:[~2020-11-12 16:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-08  9:59 [PATCH] t4013: prepare for the new default branch name "main" Johannes Schindelin via GitGitGadget
2020-11-11 21:43 ` Johannes Schindelin
2020-11-11 21:49   ` Junio C Hamano
2020-11-12 13:48     ` Johannes Schindelin
2020-11-12 16:50       ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqwnyqjz9b.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).