Re: [PATCH] t4013: prepare for the new default branch name "main"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Schindelin <Johannes.Schindelin@xxxxxx> 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 &&



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux