git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] t5310: stop expecting the default branch name `master`
@ 2020-12-06 13:17 Johannes Schindelin via GitGitGadget
  2020-12-07 18:35 ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2020-12-06 13:17 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

To open the door for changing the fall-back value for
`init.defaultBranch` when it is not set by the user, we started to
modify the test suite to work with any such fall-back value (instead of
expecting the default branch name to be `master`).

To that end, we specifically rename the initial branch from whatever it
was called to `second` (forcing it, just in case that the hard-coded
fall-back is `second`, in which case the rename is a no-op that would
fail unless forced).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
    Adjust t5310 to be independent of the default branch name
    
    Yet another patch making the test suite stop relying on master being the
    default branch name.
    
    This one goes on top of tb/pack-bitmap, and requires an update of
    js/default-branch-name-tests-final-stretch (it no longer needs to
    hard-code GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME in t5310).

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-809%2Fdscho%2Ft5310-and-the-default-branch-name-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-809/dscho/t5310-and-the-default-branch-name-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/809

 t/t5310-pack-bitmaps.sh | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/t/t5310-pack-bitmaps.sh b/t/t5310-pack-bitmaps.sh
index a83e7a93fbc..55b2cde378b 100755
--- a/t/t5310-pack-bitmaps.sh
+++ b/t/t5310-pack-bitmaps.sh
@@ -23,12 +23,12 @@ has_any () {
 # To ensure the logic for "maximal commits" is exercised, make
 # the repository a bit more complicated.
 #
-#    other                         master
+#    other                         second
 #      *                             *
 # (99 commits)                  (99 commits)
 #      *                             *
 #      |\                           /|
-#      | * octo-other  octo-master * |
+#      | * octo-other  octo-second * |
 #      |/|\_________  ____________/|\|
 #      | \          \/  __________/  |
 #      |  | ________/\ /             |
@@ -48,10 +48,10 @@ has_any () {
 #
 # The important part for the maximal commit algorithm is how
 # the bitmasks are extended. Assuming starting bit positions
-# for master (bit 0) and other (bit 1), the bitmasks at the
+# for second (bit 0) and other (bit 1), the bitmasks at the
 # end should be:
 #
-#      master: 1       (maximal, selected)
+#      second: 1       (maximal, selected)
 #       other: 01      (maximal, selected)
 #      (base): 11 (maximal)
 #
@@ -64,6 +64,7 @@ has_any () {
 
 test_expect_success 'setup repo with moderate-sized history' '
 	test_commit_bulk --id=file 10 &&
+	git branch -M second &&
 	git checkout -b other HEAD~5 &&
 	test_commit_bulk --id=side 10 &&
 
@@ -71,13 +72,13 @@ test_expect_success 'setup repo with moderate-sized history' '
 	# ambiguous merge-bases
 
 	git checkout -b merge-left other~2 &&
-	git merge master~2 -m "merge-left" &&
+	git merge second~2 -m "merge-left" &&
 
-	git checkout -b merge-right master~1 &&
+	git checkout -b merge-right second~1 &&
 	git merge other~1 -m "merge-right" &&
 
-	git checkout -b octo-master master &&
-	git merge merge-left merge-right -m "octopus-master" &&
+	git checkout -b octo-second second &&
+	git merge merge-left merge-right -m "octopus-second" &&
 
 	git checkout -b octo-other other &&
 	git merge merge-left merge-right -m "octopus-other" &&
@@ -85,24 +86,24 @@ test_expect_success 'setup repo with moderate-sized history' '
 	git checkout other &&
 	git merge octo-other -m "pull octopus" &&
 
-	git checkout master &&
-	git merge octo-master -m "pull octopus" &&
+	git checkout second &&
+	git merge octo-second -m "pull octopus" &&
 
 	# Remove these branches so they are not selected
 	# as bitmap tips
 	git branch -D merge-left &&
 	git branch -D merge-right &&
 	git branch -D octo-other &&
-	git branch -D octo-master &&
+	git branch -D octo-second &&
 
 	# add padding to make these merges less interesting
 	# and avoid having them selected for bitmaps
 	test_commit_bulk --id=file 100 &&
 	git checkout other &&
 	test_commit_bulk --id=side 100 &&
-	git checkout master &&
+	git checkout second &&
 
-	bitmaptip=$(git rev-parse master) &&
+	bitmaptip=$(git rev-parse second) &&
 	blob=$(echo tagged-blob | git hash-object -w --stdin) &&
 	git tag tagged-blob $blob &&
 	git config repack.writebitmaps true
@@ -141,8 +142,8 @@ rev_list_tests_head () {
 	'
 
 	test_expect_success "counting non-linear history ($state, $branch)" '
-		git rev-list --count other...master >expect &&
-		git rev-list --use-bitmap-index --count other...master >actual &&
+		git rev-list --count other...second >expect &&
+		git rev-list --use-bitmap-index --count other...second >actual &&
 		test_cmp expect actual
 	'
 
@@ -179,7 +180,7 @@ rev_list_tests_head () {
 rev_list_tests () {
 	state=$1
 
-	for branch in "master" "other"
+	for branch in "second" "other"
 	do
 		rev_list_tests_head
 	done
@@ -215,7 +216,7 @@ test_expect_success 'setup further non-bitmapped commits' '
 rev_list_tests 'partial bitmap'
 
 test_expect_success 'fetch (partial bitmap)' '
-	git --git-dir=clone.git fetch origin master:master &&
+	git --git-dir=clone.git fetch origin second:second &&
 	git rev-parse HEAD >expect &&
 	git --git-dir=clone.git rev-parse HEAD >actual &&
 	test_cmp expect actual
@@ -317,7 +318,7 @@ test_expect_success 'full repack, reusing previous bitmaps' '
 '
 
 test_expect_success 'fetch (full bitmap)' '
-	git --git-dir=clone.git fetch origin master:master &&
+	git --git-dir=clone.git fetch origin second:second &&
 	git rev-parse HEAD >expect &&
 	git --git-dir=clone.git rev-parse HEAD >actual &&
 	test_cmp expect actual

base-commit: b2555b4647fd66e043db04796670df89156942b6
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] t5310: stop expecting the default branch name `master`
  2020-12-06 13:17 [PATCH] t5310: stop expecting the default branch name `master` Johannes Schindelin via GitGitGadget
@ 2020-12-07 18:35 ` Junio C Hamano
  2020-12-07 18:39   ` Junio C Hamano
  2020-12-08 20:00   ` Taylor Blau
  0 siblings, 2 replies; 7+ messages in thread
From: Junio C Hamano @ 2020-12-07 18:35 UTC (permalink / raw)
  To: Johannes Schindelin via GitGitGadget, Taylor Blau
  Cc: git, Johannes Schindelin

"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
writes:

>     This one goes on top of tb/pack-bitmap, and requires an update of
>     js/default-branch-name-tests-final-stretch (it no longer needs to
>     hard-code GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME in t5310).

As the targetted topic is not in 'next' and marked with "Needs a bit
of reshuffling?", I'd appreciate this patch to be also forwarded so
that I do not have to worry about it myself.

The same goes for <pull.809.git.1607260623935.gitgitgadget@gmail.com>
which currently sits at the tip of tb/pack-bitmap.

Thanks, both.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] t5310: stop expecting the default branch name `master`
  2020-12-07 18:35 ` Junio C Hamano
@ 2020-12-07 18:39   ` Junio C Hamano
  2020-12-08 20:00   ` Taylor Blau
  1 sibling, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2020-12-07 18:39 UTC (permalink / raw)
  To: Johannes Schindelin via GitGitGadget, Sangeeta Jain
  Cc: Taylor Blau, git, Johannes Schindelin

Junio C Hamano <gitster@pobox.com> writes:

> "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
> writes:
>
>>     This one goes on top of tb/pack-bitmap, and requires an update of
>>     js/default-branch-name-tests-final-stretch (it no longer needs to
>>     hard-code GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME in t5310).
>
> As the targetted topic is not in 'next' and marked with "Needs a bit
> of reshuffling?", I'd appreciate this patch to be also forwarded so
> that I do not have to worry about it myself.
>
> The same goes for <pull.809.git.1607260623935.gitgitgadget@gmail.com>
> which currently sits at the tip of tb/pack-bitmap.

Oops--wrong branch info.  I meant the patch in
<pull.811.v2.git.1607354380671.gitgitgadget@gmail.com> that is
targetted for the "git diff" stuff.

>
> Thanks, both.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] t5310: stop expecting the default branch name `master`
  2020-12-07 18:35 ` Junio C Hamano
  2020-12-07 18:39   ` Junio C Hamano
@ 2020-12-08 20:00   ` Taylor Blau
  2020-12-08 21:13     ` Junio C Hamano
  1 sibling, 1 reply; 7+ messages in thread
From: Taylor Blau @ 2020-12-08 20:00 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Johannes Schindelin via GitGitGadget, Taylor Blau, git,
	Johannes Schindelin

On Mon, Dec 07, 2020 at 10:35:48AM -0800, Junio C Hamano wrote:
> "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
> writes:
>
> >     This one goes on top of tb/pack-bitmap, and requires an update of
> >     js/default-branch-name-tests-final-stretch (it no longer needs to
> >     hard-code GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME in t5310).
>
> As the targetted topic is not in 'next' and marked with "Needs a bit
> of reshuffling?", I'd appreciate this patch to be also forwarded so
> that I do not have to worry about it myself.

Ah, sorry that I missed this before sending out v3. I was hoping that
the fixup would be limited to one patch, but this needs to be either
spread across multiple patches, or applied at the end.

Since I already sent v3, how do you want to handle this?

Thanks,
Taylor

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] t5310: stop expecting the default branch name `master`
  2020-12-08 20:00   ` Taylor Blau
@ 2020-12-08 21:13     ` Junio C Hamano
  2020-12-08 21:36       ` Taylor Blau
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2020-12-08 21:13 UTC (permalink / raw)
  To: Taylor Blau
  Cc: Johannes Schindelin via GitGitGadget, git, Johannes Schindelin

Taylor Blau <me@ttaylorr.com> writes:

> On Mon, Dec 07, 2020 at 10:35:48AM -0800, Junio C Hamano wrote:
>> "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
>> writes:
>>
>> >     This one goes on top of tb/pack-bitmap, and requires an update of
>> >     js/default-branch-name-tests-final-stretch (it no longer needs to
>> >     hard-code GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME in t5310).
>>
>> As the targetted topic is not in 'next' and marked with "Needs a bit
>> of reshuffling?", I'd appreciate this patch to be also forwarded so
>> that I do not have to worry about it myself.
>
> Ah, sorry that I missed this before sending out v3. I was hoping that
> the fixup would be limited to one patch, but this needs to be either
> spread across multiple patches, or applied at the end.
>
> Since I already sent v3, how do you want to handle this?

As I have many other topics on the table to attend to, I can skip v3
and take v4 if it is not too much trouble to fix the issue at the
source.  Thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] t5310: stop expecting the default branch name `master`
  2020-12-08 21:13     ` Junio C Hamano
@ 2020-12-08 21:36       ` Taylor Blau
  2020-12-09 14:53         ` Johannes Schindelin
  0 siblings, 1 reply; 7+ messages in thread
From: Taylor Blau @ 2020-12-08 21:36 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Taylor Blau, Johannes Schindelin via GitGitGadget, git,
	Johannes Schindelin

On Tue, Dec 08, 2020 at 01:13:35PM -0800, Junio C Hamano wrote:
> Taylor Blau <me@ttaylorr.com> writes:
>
> > On Mon, Dec 07, 2020 at 10:35:48AM -0800, Junio C Hamano wrote:
> >> "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
> >> writes:
> >>
> >> >     This one goes on top of tb/pack-bitmap, and requires an update of
> >> >     js/default-branch-name-tests-final-stretch (it no longer needs to
> >> >     hard-code GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME in t5310).
> >>
> >> As the targetted topic is not in 'next' and marked with "Needs a bit
> >> of reshuffling?", I'd appreciate this patch to be also forwarded so
> >> that I do not have to worry about it myself.
> >
> > Ah, sorry that I missed this before sending out v3. I was hoping that
> > the fixup would be limited to one patch, but this needs to be either
> > spread across multiple patches, or applied at the end.
> >
> > Since I already sent v3, how do you want to handle this?
>
> As I have many other topics on the table to attend to, I can skip v3
> and take v4 if it is not too much trouble to fix the issue at the
> source.  Thanks.

No problem at all. Your instructions were spot on (4/24 and 15/24 needed
adjusting, as well as the later patches which could no longer be
applied after modifying those two).

Checking my work against upstream, I can see that the only diff lines
which mention "master" are removals:

$ git diff @{u}.. | grep master
-	git checkout master &&
-	bitmaptip=$(git rev-parse master) &&
-		git rev-list --count other...master >expect &&
-		git rev-list --use-bitmap-index --count other...master >actual &&
-	git --git-dir=clone.git fetch origin master:master &&
-	git --git-dir=clone.git fetch origin master:master &&

and spot checking the inter-diff between what I have and what Johannes
posted I can see that they are the same. I've added some Helped-by lines
in the relevant patches to indicate where the suggestions came from.

v4 coming shortly...

Thanks,
Taylor

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] t5310: stop expecting the default branch name `master`
  2020-12-08 21:36       ` Taylor Blau
@ 2020-12-09 14:53         ` Johannes Schindelin
  0 siblings, 0 replies; 7+ messages in thread
From: Johannes Schindelin @ 2020-12-09 14:53 UTC (permalink / raw)
  To: Taylor Blau; +Cc: Junio C Hamano, Johannes Schindelin via GitGitGadget, git

Hi Taylor,

On Tue, 8 Dec 2020, Taylor Blau wrote:

> On Tue, Dec 08, 2020 at 01:13:35PM -0800, Junio C Hamano wrote:
> > Taylor Blau <me@ttaylorr.com> writes:
> >
> > > On Mon, Dec 07, 2020 at 10:35:48AM -0800, Junio C Hamano wrote:
> > >> "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
> > >> writes:
> > >>
> > >> >     This one goes on top of tb/pack-bitmap, and requires an update of
> > >> >     js/default-branch-name-tests-final-stretch (it no longer needs to
> > >> >     hard-code GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME in t5310).
> > >>
> > >> As the targetted topic is not in 'next' and marked with "Needs a bit
> > >> of reshuffling?", I'd appreciate this patch to be also forwarded so
> > >> that I do not have to worry about it myself.
> > >
> > > Ah, sorry that I missed this before sending out v3. I was hoping that
> > > the fixup would be limited to one patch, but this needs to be either
> > > spread across multiple patches, or applied at the end.
> > >
> > > Since I already sent v3, how do you want to handle this?
> >
> > As I have many other topics on the table to attend to, I can skip v3
> > and take v4 if it is not too much trouble to fix the issue at the
> > source.  Thanks.
>
> No problem at all. Your instructions were spot on (4/24 and 15/24 needed
> adjusting, as well as the later patches which could no longer be
> applied after modifying those two).
>
> Checking my work against upstream, I can see that the only diff lines
> which mention "master" are removals:
>
> $ git diff @{u}.. | grep master
> -	git checkout master &&
> -	bitmaptip=$(git rev-parse master) &&
> -		git rev-list --count other...master >expect &&
> -		git rev-list --use-bitmap-index --count other...master >actual &&
> -	git --git-dir=clone.git fetch origin master:master &&
> -	git --git-dir=clone.git fetch origin master:master &&
>
> and spot checking the inter-diff between what I have and what Johannes
> posted I can see that they are the same. I've added some Helped-by lines
> in the relevant patches to indicate where the suggestions came from.
>
> v4 coming shortly...

Thank you so much for picking this up!

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-12-09 14:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-06 13:17 [PATCH] t5310: stop expecting the default branch name `master` Johannes Schindelin via GitGitGadget
2020-12-07 18:35 ` Junio C Hamano
2020-12-07 18:39   ` Junio C Hamano
2020-12-08 20:00   ` Taylor Blau
2020-12-08 21:13     ` Junio C Hamano
2020-12-08 21:36       ` Taylor Blau
2020-12-09 14:53         ` Johannes Schindelin

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).