git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/2] Avoid main as branch name in the test suite
@ 2020-10-05  8:56 Johannes Schindelin via GitGitGadget
  2020-10-05  8:56 ` [PATCH 1/2] t1415: avoid using `main` as ref name Johannes Schindelin via GitGitGadget
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2020-10-05  8:56 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin

In preparation for changing the default branch name to main, let's stop
using it as non-default branch name in the test suite.

This is the last preparatory step before the patch series that intends to
change the default branch name to main. See 
https://github.com/gitgitgadget/git/pull/655 for the entire game plan.

Johannes Schindelin (2):
  t1415: avoid using `main` as ref name
  tests: avoid using the branch name `main`

 t/t1415-worktree-refs.sh     | 18 +++++++++---------
 t/t6012-rev-list-simplify.sh |  8 ++++----
 t/t6400-merge-df.sh          |  8 ++++----
 t/t6409-merge-subtree.sh     | 12 ++++++------
 t/t6430-merge-recursive.sh   |  4 ++--
 5 files changed, 25 insertions(+), 25 deletions(-)


base-commit: 306ee63a703ad67c54ba1209dc11dd9ea500dc1f
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-743%2Fdscho%2Favoid-main-as-branch-name-in-tests-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-743/dscho/avoid-main-as-branch-name-in-tests-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/743
-- 
gitgitgadget

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

* [PATCH 1/2] t1415: avoid using `main` as ref name
  2020-10-05  8:56 [PATCH 0/2] Avoid main as branch name in the test suite Johannes Schindelin via GitGitGadget
@ 2020-10-05  8:56 ` Johannes Schindelin via GitGitGadget
  2020-10-05  9:54   ` Jonathan Nieder
  2020-10-05  8:56 ` [PATCH 2/2] tests: avoid using the branch name `main` Johannes Schindelin via GitGitGadget
  2020-10-08 10:13 ` [PATCH v2 0/2] Avoid main as branch name in the test suite Johannes Schindelin via GitGitGadget
  2 siblings, 1 reply; 11+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2020-10-05  8:56 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Johannes Schindelin

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

In preparation for a patch series that will change the fall-back for
`init.defaultBranch` to `main`, let's not use `main` as ref name in this
test script.

Since we already use the name "second" for a secondary worktree that is
created in this test, let's use the name "first" for those refs instead.

While at it, adjust the test titles where "repo" was used by mistake
instead of the term "worktree".

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t1415-worktree-refs.sh | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/t/t1415-worktree-refs.sh b/t/t1415-worktree-refs.sh
index bb2c7572a3..7ab91241ab 100755
--- a/t/t1415-worktree-refs.sh
+++ b/t/t1415-worktree-refs.sh
@@ -76,24 +76,24 @@ test_expect_success 'reflog of worktrees/xx/HEAD' '
 	test_cmp expected actual.wt2
 '
 
-test_expect_success 'for-each-ref from main repo' '
+test_expect_success 'for-each-ref from main worktree' '
 	mkdir fer1 &&
 	git -C fer1 init repo &&
 	test_commit -C fer1/repo initial &&
 	git -C fer1/repo worktree add ../second &&
-	git -C fer1/repo update-ref refs/bisect/main HEAD &&
-	git -C fer1/repo update-ref refs/rewritten/main HEAD &&
-	git -C fer1/repo update-ref refs/worktree/main HEAD &&
-	git -C fer1/repo for-each-ref --format="%(refname)" | grep main >actual &&
+	git -C fer1/repo update-ref refs/bisect/first HEAD &&
+	git -C fer1/repo update-ref refs/rewritten/first HEAD &&
+	git -C fer1/repo update-ref refs/worktree/first HEAD &&
+	git -C fer1/repo for-each-ref --format="%(refname)" | grep first >actual &&
 	cat >expected <<-\EOF &&
-	refs/bisect/main
-	refs/rewritten/main
-	refs/worktree/main
+	refs/bisect/first
+	refs/rewritten/first
+	refs/worktree/first
 	EOF
 	test_cmp expected actual
 '
 
-test_expect_success 'for-each-ref from linked repo' '
+test_expect_success 'for-each-ref from linked worktree' '
 	mkdir fer2 &&
 	git -C fer2 init repo &&
 	test_commit -C fer2/repo initial &&
-- 
gitgitgadget


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

* [PATCH 2/2] tests: avoid using the branch name `main`
  2020-10-05  8:56 [PATCH 0/2] Avoid main as branch name in the test suite Johannes Schindelin via GitGitGadget
  2020-10-05  8:56 ` [PATCH 1/2] t1415: avoid using `main` as ref name Johannes Schindelin via GitGitGadget
@ 2020-10-05  8:56 ` Johannes Schindelin via GitGitGadget
  2020-10-05  9:59   ` Jonathan Nieder
  2020-10-08 10:13 ` [PATCH v2 0/2] Avoid main as branch name in the test suite Johannes Schindelin via GitGitGadget
  2 siblings, 1 reply; 11+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2020-10-05  8:56 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Johannes Schindelin

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

In the near future, we want to change Git's default branch name to
`main`. In preparation for that, stop using it as a branch name in the
test suite. Replace that branch name by `primary`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t6012-rev-list-simplify.sh |  8 ++++----
 t/t6400-merge-df.sh          |  8 ++++----
 t/t6409-merge-subtree.sh     | 12 ++++++------
 t/t6430-merge-recursive.sh   |  4 ++--
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/t/t6012-rev-list-simplify.sh b/t/t6012-rev-list-simplify.sh
index b6fa43ace0..f1296c29e6 100755
--- a/t/t6012-rev-list-simplify.sh
+++ b/t/t6012-rev-list-simplify.sh
@@ -171,7 +171,7 @@ test_expect_success '--full-diff is not affected by --parents' '
 test_expect_success 'rebuild repo' '
 	rm -rf .git * &&
 	git init &&
-	git switch -c main &&
+	git switch -c primary &&
 
 	echo base >file &&
 	git add file &&
@@ -186,7 +186,7 @@ test_expect_success 'rebuild repo' '
 	git add file &&
 	test_commit B &&
 
-	git switch main &&
+	git switch primary &&
 	test_must_fail git merge -m "M" B &&
 	echo A >file &&
 	echo B >>file &&
@@ -207,7 +207,7 @@ test_expect_success 'rebuild repo' '
 	git merge -m R -Xtheirs X &&
 	note R &&
 
-	git switch main &&
+	git switch primary &&
 	git merge -m N R &&
 	note N &&
 
@@ -221,7 +221,7 @@ test_expect_success 'rebuild repo' '
 	git add z &&
 	test_commit Z &&
 
-	git switch main &&
+	git switch primary &&
 	git merge -m O Z &&
 	note O &&
 
diff --git a/t/t6400-merge-df.sh b/t/t6400-merge-df.sh
index 400a4cd139..15f540aae3 100755
--- a/t/t6400-merge-df.sh
+++ b/t/t6400-merge-df.sh
@@ -124,7 +124,7 @@ test_expect_success 'Simple merge in repo with interesting pathnames' '
 		git add . &&
 		git commit -m initial &&
 
-		git branch main &&
+		git branch primary &&
 		git branch other &&
 
 		git checkout other &&
@@ -132,10 +132,10 @@ test_expect_success 'Simple merge in repo with interesting pathnames' '
 		git add -u &&
 		git commit -m other &&
 
-		git checkout main &&
-		echo main >foo/bar/baz &&
+		git checkout primary &&
+		echo primary >foo/bar/baz &&
 		git add -u &&
-		git commit -m main &&
+		git commit -m primary &&
 
 		git merge other &&
 		git ls-files -s >out &&
diff --git a/t/t6409-merge-subtree.sh b/t/t6409-merge-subtree.sh
index 793f0c8bf3..c236180238 100755
--- a/t/t6409-merge-subtree.sh
+++ b/t/t6409-merge-subtree.sh
@@ -35,11 +35,11 @@ test_expect_success 'setup branch sub' '
 	test_commit foo
 '
 
-test_expect_success 'setup branch main' '
-	git checkout -b main master &&
+test_expect_success 'setup branch primary' '
+	git checkout -b primary master &&
 	git merge -s ours --no-commit --allow-unrelated-histories sub &&
 	git read-tree --prefix=dir/ -u sub &&
-	git commit -m "initial merge of sub into main" &&
+	git commit -m "initial merge of sub into primary" &&
 	test_path_is_file dir/foo.t &&
 	test_path_is_file hello
 '
@@ -49,9 +49,9 @@ test_expect_success 'update branch sub' '
 	test_commit bar
 '
 
-test_expect_success 'update branch main' '
-	git checkout main &&
-	git merge -s subtree sub -m "second merge of sub into main" &&
+test_expect_success 'update branch primary' '
+	git checkout primary &&
+	git merge -s subtree sub -m "second merge of sub into primary" &&
 	test_path_is_file dir/bar.t &&
 	test_path_is_file dir/foo.t &&
 	test_path_is_file hello
diff --git a/t/t6430-merge-recursive.sh b/t/t6430-merge-recursive.sh
index d48d211a95..900e5c63a7 100755
--- a/t/t6430-merge-recursive.sh
+++ b/t/t6430-merge-recursive.sh
@@ -663,7 +663,7 @@ test_expect_failure 'merge-recursive rename vs. rename/symlink' '
 
 test_expect_success 'merging with triple rename across D/F conflict' '
 	git reset --hard HEAD &&
-	git checkout -b main &&
+	git checkout -b primary &&
 	git rm -rf . &&
 
 	echo "just a file" >sub1 &&
@@ -682,7 +682,7 @@ test_expect_success 'merging with triple rename across D/F conflict' '
 	test_tick &&
 	git commit -a -m changesimplefile &&
 
-	git checkout main &&
+	git checkout primary &&
 	git rm sub1 &&
 	git mv sub2 sub1 &&
 	test_tick &&
-- 
gitgitgadget

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

* Re: [PATCH 1/2] t1415: avoid using `main` as ref name
  2020-10-05  8:56 ` [PATCH 1/2] t1415: avoid using `main` as ref name Johannes Schindelin via GitGitGadget
@ 2020-10-05  9:54   ` Jonathan Nieder
  2020-10-08  7:56     ` Johannes Schindelin
  0 siblings, 1 reply; 11+ messages in thread
From: Jonathan Nieder @ 2020-10-05  9:54 UTC (permalink / raw)
  To: Johannes Schindelin via GitGitGadget; +Cc: git, Johannes Schindelin

Hi,

Johannes Schindelin wrote:

> In preparation for a patch series that will change the fall-back for
> `init.defaultBranch` to `main`, let's not use `main` as ref name in this
> test script.

Interesting.  I assume the issue is this line?

	-	git -C fer1/repo for-each-ref --format="%(refname)" | grep main >actual &&

I.e., it's not actually that naming a worktree "main" will break
anything, but just that the test catches refs/heads/main in the same
net when it does grepping?

If the commit message explains that, then this patch looks good to me.
Without such an explanation, it would make me fear that we have some
underlying bug in "git worktree".

Thanks,
Jonathan

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

* Re: [PATCH 2/2] tests: avoid using the branch name `main`
  2020-10-05  8:56 ` [PATCH 2/2] tests: avoid using the branch name `main` Johannes Schindelin via GitGitGadget
@ 2020-10-05  9:59   ` Jonathan Nieder
  2020-10-08  8:05     ` Johannes Schindelin
  0 siblings, 1 reply; 11+ messages in thread
From: Jonathan Nieder @ 2020-10-05  9:59 UTC (permalink / raw)
  To: Johannes Schindelin via GitGitGadget; +Cc: git, Johannes Schindelin

Johannes Schindelin wrote:

> In the near future, we want to change Git's default branch name to
> `main`. In preparation for that, stop using it as a branch name in the
> test suite. Replace that branch name by `primary`.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  t/t6012-rev-list-simplify.sh |  8 ++++----
>  t/t6400-merge-df.sh          |  8 ++++----
>  t/t6409-merge-subtree.sh     | 12 ++++++------
>  t/t6430-merge-recursive.sh   |  4 ++--
>  4 files changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/t/t6012-rev-list-simplify.sh b/t/t6012-rev-list-simplify.sh
> index b6fa43ace0..f1296c29e6 100755
> --- a/t/t6012-rev-list-simplify.sh
> +++ b/t/t6012-rev-list-simplify.sh
> @@ -171,7 +171,7 @@ test_expect_success '--full-diff is not affected by --parents' '
>  test_expect_success 'rebuild repo' '
>  	rm -rf .git * &&
>  	git init &&
> -	git switch -c main &&
> +	git switch -c primary &&

Is there a secondary corresponding to this primary?

I guess the idea is that this is the trunk that other branches branch
from?  Looking at the history, it seems that this test was added
relatively recently and it may have had the upcoming branch name change
in mind (or in other words if it were an older test it might be expected
to use "master").

That suggests an alternative that is agnostic to init.defaultBranch:
what if this uses "git switch -C main"?

Thanks,
Jonathan

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

* Re: [PATCH 1/2] t1415: avoid using `main` as ref name
  2020-10-05  9:54   ` Jonathan Nieder
@ 2020-10-08  7:56     ` Johannes Schindelin
  0 siblings, 0 replies; 11+ messages in thread
From: Johannes Schindelin @ 2020-10-08  7:56 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Johannes Schindelin via GitGitGadget, git

Hi Jonathan,

On Mon, 5 Oct 2020, Jonathan Nieder wrote:

>
> Johannes Schindelin wrote:
>
> > In preparation for a patch series that will change the fall-back for
> > `init.defaultBranch` to `main`, let's not use `main` as ref name in
> > this test script.
>
> Interesting.  I assume the issue is this line?
>
> 	-	git -C fer1/repo for-each-ref --format="%(refname)" | grep main >actual &&
>
> I.e., it's not actually that naming a worktree "main" will break
> anything, but just that the test catches refs/heads/main in the same
> net when it does grepping?

Right.

> If the commit message explains that, then this patch looks good to me.
> Without such an explanation, it would make me fear that we have some
> underlying bug in "git worktree".

Indeed. This is my current revision of the commit message:

    t1415: avoid using `main` as ref name

    In preparation for a patch series that will change the fall-back for
    `init.defaultBranch` to `main`, let's not use `main` as ref name in this
    test script.

    Otherwise, the `git for-each-ref ... | grep main` which wants to catch
    those refs would also unexpectedly catch `refs/heads/main`.

    Since the refs in question are worktree-local ones (i.e. each worktree
    has their own, just like `HEAD`), and since the test case already uses a
    secondary worktree called "second", let's use the name "first" for those
    refs instead.

    While at it, adjust the test titles that talk about a "repo" when they
    meant a "worktree" instead.

Ciao,
Dscho

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

* Re: [PATCH 2/2] tests: avoid using the branch name `main`
  2020-10-05  9:59   ` Jonathan Nieder
@ 2020-10-08  8:05     ` Johannes Schindelin
  2020-10-08 18:15       ` Derrick Stolee
  0 siblings, 1 reply; 11+ messages in thread
From: Johannes Schindelin @ 2020-10-08  8:05 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Johannes Schindelin via GitGitGadget, git, Derrick Stolee

Hi Jonathan,

On Mon, 5 Oct 2020, Jonathan Nieder wrote:

> Johannes Schindelin wrote:
>
> > In the near future, we want to change Git's default branch name to
> > `main`. In preparation for that, stop using it as a branch name in the
> > test suite. Replace that branch name by `primary`.
> >
> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> > ---
> >  t/t6012-rev-list-simplify.sh |  8 ++++----
> >  t/t6400-merge-df.sh          |  8 ++++----
> >  t/t6409-merge-subtree.sh     | 12 ++++++------
> >  t/t6430-merge-recursive.sh   |  4 ++--
> >  4 files changed, 16 insertions(+), 16 deletions(-)
> >
> > diff --git a/t/t6012-rev-list-simplify.sh b/t/t6012-rev-list-simplify.sh
> > index b6fa43ace0..f1296c29e6 100755
> > --- a/t/t6012-rev-list-simplify.sh
> > +++ b/t/t6012-rev-list-simplify.sh
> > @@ -171,7 +171,7 @@ test_expect_success '--full-diff is not affected by --parents' '
> >  test_expect_success 'rebuild repo' '
> >  	rm -rf .git * &&
> >  	git init &&
> > -	git switch -c main &&
> > +	git switch -c primary &&
>
> Is there a secondary corresponding to this primary?

Nope, of course not ;-)

> I guess the idea is that this is the trunk that other branches branch
> from?  Looking at the history, it seems that this test was added
> relatively recently and it may have had the upcoming branch name change
> in mind (or in other words if it were an older test it might be expected
> to use "master").

I guess that Stolee (Cc:ed) had something like that in mind.

When I look at 8d049e182e2 (revision: --show-pulls adds helpful
merges, 2020-04-10), I get the impression that does not _really_ care
about the name of the main branch, it just wants to know the name so it
can switch back and forth.

If I had had the presence of mind when reviewing that patch back in April,
I would probably have advocated for the use of `git switch -`...

In any case, I would like to keep this consistent with the remainder of
the test scripts modified by this patch, and use the relatively neutral
`topic` here.

Ciao,
Dscho

> That suggests an alternative that is agnostic to init.defaultBranch:
> what if this uses "git switch -C main"?
>
> Thanks,
> Jonathan
>

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

* [PATCH v2 0/2] Avoid main as branch name in the test suite
  2020-10-05  8:56 [PATCH 0/2] Avoid main as branch name in the test suite Johannes Schindelin via GitGitGadget
  2020-10-05  8:56 ` [PATCH 1/2] t1415: avoid using `main` as ref name Johannes Schindelin via GitGitGadget
  2020-10-05  8:56 ` [PATCH 2/2] tests: avoid using the branch name `main` Johannes Schindelin via GitGitGadget
@ 2020-10-08 10:13 ` Johannes Schindelin via GitGitGadget
  2020-10-08 10:13   ` [PATCH v2 1/2] t1415: avoid using `main` as ref name Johannes Schindelin via GitGitGadget
  2020-10-08 10:13   ` [PATCH v2 2/2] tests: avoid using the branch name `main` Johannes Schindelin via GitGitGadget
  2 siblings, 2 replies; 11+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2020-10-08 10:13 UTC (permalink / raw)
  To: git; +Cc: Jonathan Nieder, Johannes Schindelin, Johannes Schindelin

In preparation for changing the default branch name to main, let's stop
using it as non-default branch name in the test suite.

This is the last preparatory step before the patch series that intends to
change the default branch name to main. See 
https://github.com/gitgitgadget/git/pull/655 for the entire game plan.

Changes since v1:

 * The commit message of the t1415 patch elaborates a but more about the
   rationale for the change.
 * Instead of primary, the second patch renames all of those branches to 
   topic, imitating b6211b89eb3 (tests: avoid variations of the master 
   branch name, 2020-09-26).

Johannes Schindelin (2):
  t1415: avoid using `main` as ref name
  tests: avoid using the branch name `main`

 t/t1415-worktree-refs.sh     | 18 +++++++++---------
 t/t6012-rev-list-simplify.sh |  8 ++++----
 t/t6400-merge-df.sh          |  8 ++++----
 t/t6409-merge-subtree.sh     | 12 ++++++------
 t/t6430-merge-recursive.sh   |  4 ++--
 5 files changed, 25 insertions(+), 25 deletions(-)


base-commit: 306ee63a703ad67c54ba1209dc11dd9ea500dc1f
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-743%2Fdscho%2Favoid-main-as-branch-name-in-tests-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-743/dscho/avoid-main-as-branch-name-in-tests-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/743

Range-diff vs v1:

 1:  d3f7b39a2f ! 1:  2c6f41f9ad t1415: avoid using `main` as ref name
     @@ Commit message
          `init.defaultBranch` to `main`, let's not use `main` as ref name in this
          test script.
      
     -    Since we already use the name "second" for a secondary worktree that is
     -    created in this test, let's use the name "first" for those refs instead.
     +    Otherwise, the `git for-each-ref ... | grep main` which wants to catch
     +    those refs would also unexpectedly catch `refs/heads/main`.
      
     -    While at it, adjust the test titles where "repo" was used by mistake
     -    instead of the term "worktree".
     +    Since the refs in question are worktree-local ones (i.e. each worktree
     +    has their own, just like `HEAD`), and since the test case already uses a
     +    secondary worktree called "second", let's use the name "first" for those
     +    refs instead.
     +
     +    While at it, adjust the test titles that talk about a "repo" when they
     +    meant a "worktree" instead.
      
          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
      
 2:  6045ceb938 ! 2:  b187571778 tests: avoid using the branch name `main`
     @@ Commit message
      
          In the near future, we want to change Git's default branch name to
          `main`. In preparation for that, stop using it as a branch name in the
     -    test suite. Replace that branch name by `primary`.
     +    test suite. Replace that branch name by `topic`, the same name we used
     +    to rename variations of `master` in b6211b89eb3 (tests: avoid variations
     +    of the `master` branch name, 2020-09-26).
      
          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
      
     @@ t/t6012-rev-list-simplify.sh: test_expect_success '--full-diff is not affected b
       	rm -rf .git * &&
       	git init &&
      -	git switch -c main &&
     -+	git switch -c primary &&
     ++	git switch -c topic &&
       
       	echo base >file &&
       	git add file &&
     @@ t/t6012-rev-list-simplify.sh: test_expect_success 'rebuild repo' '
       	test_commit B &&
       
      -	git switch main &&
     -+	git switch primary &&
     ++	git switch topic &&
       	test_must_fail git merge -m "M" B &&
       	echo A >file &&
       	echo B >>file &&
     @@ t/t6012-rev-list-simplify.sh: test_expect_success 'rebuild repo' '
       	note R &&
       
      -	git switch main &&
     -+	git switch primary &&
     ++	git switch topic &&
       	git merge -m N R &&
       	note N &&
       
     @@ t/t6012-rev-list-simplify.sh: test_expect_success 'rebuild repo' '
       	test_commit Z &&
       
      -	git switch main &&
     -+	git switch primary &&
     ++	git switch topic &&
       	git merge -m O Z &&
       	note O &&
       
     @@ t/t6400-merge-df.sh: test_expect_success 'Simple merge in repo with interesting
       		git commit -m initial &&
       
      -		git branch main &&
     -+		git branch primary &&
     ++		git branch topic &&
       		git branch other &&
       
       		git checkout other &&
     @@ t/t6400-merge-df.sh: test_expect_success 'Simple merge in repo with interesting
       
      -		git checkout main &&
      -		echo main >foo/bar/baz &&
     -+		git checkout primary &&
     -+		echo primary >foo/bar/baz &&
     ++		git checkout topic &&
     ++		echo topic >foo/bar/baz &&
       		git add -u &&
      -		git commit -m main &&
     -+		git commit -m primary &&
     ++		git commit -m topic &&
       
       		git merge other &&
       		git ls-files -s >out &&
     @@ t/t6409-merge-subtree.sh: test_expect_success 'setup branch sub' '
       
      -test_expect_success 'setup branch main' '
      -	git checkout -b main master &&
     -+test_expect_success 'setup branch primary' '
     -+	git checkout -b primary master &&
     ++test_expect_success 'setup topic branch' '
     ++	git checkout -b topic master &&
       	git merge -s ours --no-commit --allow-unrelated-histories sub &&
       	git read-tree --prefix=dir/ -u sub &&
      -	git commit -m "initial merge of sub into main" &&
     -+	git commit -m "initial merge of sub into primary" &&
     ++	git commit -m "initial merge of sub into topic" &&
       	test_path_is_file dir/foo.t &&
       	test_path_is_file hello
       '
     @@ t/t6409-merge-subtree.sh: test_expect_success 'update branch sub' '
      -test_expect_success 'update branch main' '
      -	git checkout main &&
      -	git merge -s subtree sub -m "second merge of sub into main" &&
     -+test_expect_success 'update branch primary' '
     -+	git checkout primary &&
     -+	git merge -s subtree sub -m "second merge of sub into primary" &&
     ++test_expect_success 'update topic branch' '
     ++	git checkout topic &&
     ++	git merge -s subtree sub -m "second merge of sub into topic" &&
       	test_path_is_file dir/bar.t &&
       	test_path_is_file dir/foo.t &&
       	test_path_is_file hello
     @@ t/t6430-merge-recursive.sh: test_expect_failure 'merge-recursive rename vs. rena
       test_expect_success 'merging with triple rename across D/F conflict' '
       	git reset --hard HEAD &&
      -	git checkout -b main &&
     -+	git checkout -b primary &&
     ++	git checkout -b topic &&
       	git rm -rf . &&
       
       	echo "just a file" >sub1 &&
     @@ t/t6430-merge-recursive.sh: test_expect_success 'merging with triple rename acro
       	git commit -a -m changesimplefile &&
       
      -	git checkout main &&
     -+	git checkout primary &&
     ++	git checkout topic &&
       	git rm sub1 &&
       	git mv sub2 sub1 &&
       	test_tick &&

-- 
gitgitgadget

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

* [PATCH v2 1/2] t1415: avoid using `main` as ref name
  2020-10-08 10:13 ` [PATCH v2 0/2] Avoid main as branch name in the test suite Johannes Schindelin via GitGitGadget
@ 2020-10-08 10:13   ` Johannes Schindelin via GitGitGadget
  2020-10-08 10:13   ` [PATCH v2 2/2] tests: avoid using the branch name `main` Johannes Schindelin via GitGitGadget
  1 sibling, 0 replies; 11+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2020-10-08 10:13 UTC (permalink / raw)
  To: git
  Cc: Jonathan Nieder, Johannes Schindelin, Johannes Schindelin,
	Johannes Schindelin

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

In preparation for a patch series that will change the fall-back for
`init.defaultBranch` to `main`, let's not use `main` as ref name in this
test script.

Otherwise, the `git for-each-ref ... | grep main` which wants to catch
those refs would also unexpectedly catch `refs/heads/main`.

Since the refs in question are worktree-local ones (i.e. each worktree
has their own, just like `HEAD`), and since the test case already uses a
secondary worktree called "second", let's use the name "first" for those
refs instead.

While at it, adjust the test titles that talk about a "repo" when they
meant a "worktree" instead.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t1415-worktree-refs.sh | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/t/t1415-worktree-refs.sh b/t/t1415-worktree-refs.sh
index bb2c7572a3..7ab91241ab 100755
--- a/t/t1415-worktree-refs.sh
+++ b/t/t1415-worktree-refs.sh
@@ -76,24 +76,24 @@ test_expect_success 'reflog of worktrees/xx/HEAD' '
 	test_cmp expected actual.wt2
 '
 
-test_expect_success 'for-each-ref from main repo' '
+test_expect_success 'for-each-ref from main worktree' '
 	mkdir fer1 &&
 	git -C fer1 init repo &&
 	test_commit -C fer1/repo initial &&
 	git -C fer1/repo worktree add ../second &&
-	git -C fer1/repo update-ref refs/bisect/main HEAD &&
-	git -C fer1/repo update-ref refs/rewritten/main HEAD &&
-	git -C fer1/repo update-ref refs/worktree/main HEAD &&
-	git -C fer1/repo for-each-ref --format="%(refname)" | grep main >actual &&
+	git -C fer1/repo update-ref refs/bisect/first HEAD &&
+	git -C fer1/repo update-ref refs/rewritten/first HEAD &&
+	git -C fer1/repo update-ref refs/worktree/first HEAD &&
+	git -C fer1/repo for-each-ref --format="%(refname)" | grep first >actual &&
 	cat >expected <<-\EOF &&
-	refs/bisect/main
-	refs/rewritten/main
-	refs/worktree/main
+	refs/bisect/first
+	refs/rewritten/first
+	refs/worktree/first
 	EOF
 	test_cmp expected actual
 '
 
-test_expect_success 'for-each-ref from linked repo' '
+test_expect_success 'for-each-ref from linked worktree' '
 	mkdir fer2 &&
 	git -C fer2 init repo &&
 	test_commit -C fer2/repo initial &&
-- 
gitgitgadget


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

* [PATCH v2 2/2] tests: avoid using the branch name `main`
  2020-10-08 10:13 ` [PATCH v2 0/2] Avoid main as branch name in the test suite Johannes Schindelin via GitGitGadget
  2020-10-08 10:13   ` [PATCH v2 1/2] t1415: avoid using `main` as ref name Johannes Schindelin via GitGitGadget
@ 2020-10-08 10:13   ` Johannes Schindelin via GitGitGadget
  1 sibling, 0 replies; 11+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2020-10-08 10:13 UTC (permalink / raw)
  To: git
  Cc: Jonathan Nieder, Johannes Schindelin, Johannes Schindelin,
	Johannes Schindelin

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

In the near future, we want to change Git's default branch name to
`main`. In preparation for that, stop using it as a branch name in the
test suite. Replace that branch name by `topic`, the same name we used
to rename variations of `master` in b6211b89eb3 (tests: avoid variations
of the `master` branch name, 2020-09-26).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t6012-rev-list-simplify.sh |  8 ++++----
 t/t6400-merge-df.sh          |  8 ++++----
 t/t6409-merge-subtree.sh     | 12 ++++++------
 t/t6430-merge-recursive.sh   |  4 ++--
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/t/t6012-rev-list-simplify.sh b/t/t6012-rev-list-simplify.sh
index b6fa43ace0..7fc10f8593 100755
--- a/t/t6012-rev-list-simplify.sh
+++ b/t/t6012-rev-list-simplify.sh
@@ -171,7 +171,7 @@ test_expect_success '--full-diff is not affected by --parents' '
 test_expect_success 'rebuild repo' '
 	rm -rf .git * &&
 	git init &&
-	git switch -c main &&
+	git switch -c topic &&
 
 	echo base >file &&
 	git add file &&
@@ -186,7 +186,7 @@ test_expect_success 'rebuild repo' '
 	git add file &&
 	test_commit B &&
 
-	git switch main &&
+	git switch topic &&
 	test_must_fail git merge -m "M" B &&
 	echo A >file &&
 	echo B >>file &&
@@ -207,7 +207,7 @@ test_expect_success 'rebuild repo' '
 	git merge -m R -Xtheirs X &&
 	note R &&
 
-	git switch main &&
+	git switch topic &&
 	git merge -m N R &&
 	note N &&
 
@@ -221,7 +221,7 @@ test_expect_success 'rebuild repo' '
 	git add z &&
 	test_commit Z &&
 
-	git switch main &&
+	git switch topic &&
 	git merge -m O Z &&
 	note O &&
 
diff --git a/t/t6400-merge-df.sh b/t/t6400-merge-df.sh
index 400a4cd139..f1b84617af 100755
--- a/t/t6400-merge-df.sh
+++ b/t/t6400-merge-df.sh
@@ -124,7 +124,7 @@ test_expect_success 'Simple merge in repo with interesting pathnames' '
 		git add . &&
 		git commit -m initial &&
 
-		git branch main &&
+		git branch topic &&
 		git branch other &&
 
 		git checkout other &&
@@ -132,10 +132,10 @@ test_expect_success 'Simple merge in repo with interesting pathnames' '
 		git add -u &&
 		git commit -m other &&
 
-		git checkout main &&
-		echo main >foo/bar/baz &&
+		git checkout topic &&
+		echo topic >foo/bar/baz &&
 		git add -u &&
-		git commit -m main &&
+		git commit -m topic &&
 
 		git merge other &&
 		git ls-files -s >out &&
diff --git a/t/t6409-merge-subtree.sh b/t/t6409-merge-subtree.sh
index 793f0c8bf3..8b11e00ded 100755
--- a/t/t6409-merge-subtree.sh
+++ b/t/t6409-merge-subtree.sh
@@ -35,11 +35,11 @@ test_expect_success 'setup branch sub' '
 	test_commit foo
 '
 
-test_expect_success 'setup branch main' '
-	git checkout -b main master &&
+test_expect_success 'setup topic branch' '
+	git checkout -b topic master &&
 	git merge -s ours --no-commit --allow-unrelated-histories sub &&
 	git read-tree --prefix=dir/ -u sub &&
-	git commit -m "initial merge of sub into main" &&
+	git commit -m "initial merge of sub into topic" &&
 	test_path_is_file dir/foo.t &&
 	test_path_is_file hello
 '
@@ -49,9 +49,9 @@ test_expect_success 'update branch sub' '
 	test_commit bar
 '
 
-test_expect_success 'update branch main' '
-	git checkout main &&
-	git merge -s subtree sub -m "second merge of sub into main" &&
+test_expect_success 'update topic branch' '
+	git checkout topic &&
+	git merge -s subtree sub -m "second merge of sub into topic" &&
 	test_path_is_file dir/bar.t &&
 	test_path_is_file dir/foo.t &&
 	test_path_is_file hello
diff --git a/t/t6430-merge-recursive.sh b/t/t6430-merge-recursive.sh
index d48d211a95..a328260d42 100755
--- a/t/t6430-merge-recursive.sh
+++ b/t/t6430-merge-recursive.sh
@@ -663,7 +663,7 @@ test_expect_failure 'merge-recursive rename vs. rename/symlink' '
 
 test_expect_success 'merging with triple rename across D/F conflict' '
 	git reset --hard HEAD &&
-	git checkout -b main &&
+	git checkout -b topic &&
 	git rm -rf . &&
 
 	echo "just a file" >sub1 &&
@@ -682,7 +682,7 @@ test_expect_success 'merging with triple rename across D/F conflict' '
 	test_tick &&
 	git commit -a -m changesimplefile &&
 
-	git checkout main &&
+	git checkout topic &&
 	git rm sub1 &&
 	git mv sub2 sub1 &&
 	test_tick &&
-- 
gitgitgadget

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

* Re: [PATCH 2/2] tests: avoid using the branch name `main`
  2020-10-08  8:05     ` Johannes Schindelin
@ 2020-10-08 18:15       ` Derrick Stolee
  0 siblings, 0 replies; 11+ messages in thread
From: Derrick Stolee @ 2020-10-08 18:15 UTC (permalink / raw)
  To: Johannes Schindelin, Jonathan Nieder
  Cc: Johannes Schindelin via GitGitGadget, git

On 10/8/2020 4:05 AM, Johannes Schindelin wrote:
> On Mon, 5 Oct 2020, Jonathan Nieder wrote:
>> Johannes Schindelin wrote:
>>> -	git switch -c main &&
>>> +	git switch -c primary &&
>>
>> Is there a secondary corresponding to this primary?
> 
> Nope, of course not ;-)
> 
>> I guess the idea is that this is the trunk that other branches branch
>> from?  Looking at the history, it seems that this test was added
>> relatively recently and it may have had the upcoming branch name change
>> in mind (or in other words if it were an older test it might be expected
>> to use "master").
> 
> I guess that Stolee (Cc:ed) had something like that in mind.
> 
> When I look at 8d049e182e2 (revision: --show-pulls adds helpful
> merges, 2020-04-10), I get the impression that does not _really_ care
> about the name of the main branch, it just wants to know the name so it
> can switch back and forth.

The branch name here is not important, so please replace it
with whatever works best for you.

What _is_ important is keeping the commit messages in agreement with
the commented ASCII-art DAG above this test. It does not mention the
branch names, so this change will not cause an inconsistent comment.

Thanks,
-Stolee

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

end of thread, other threads:[~2020-10-08 18:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-05  8:56 [PATCH 0/2] Avoid main as branch name in the test suite Johannes Schindelin via GitGitGadget
2020-10-05  8:56 ` [PATCH 1/2] t1415: avoid using `main` as ref name Johannes Schindelin via GitGitGadget
2020-10-05  9:54   ` Jonathan Nieder
2020-10-08  7:56     ` Johannes Schindelin
2020-10-05  8:56 ` [PATCH 2/2] tests: avoid using the branch name `main` Johannes Schindelin via GitGitGadget
2020-10-05  9:59   ` Jonathan Nieder
2020-10-08  8:05     ` Johannes Schindelin
2020-10-08 18:15       ` Derrick Stolee
2020-10-08 10:13 ` [PATCH v2 0/2] Avoid main as branch name in the test suite Johannes Schindelin via GitGitGadget
2020-10-08 10:13   ` [PATCH v2 1/2] t1415: avoid using `main` as ref name Johannes Schindelin via GitGitGadget
2020-10-08 10:13   ` [PATCH v2 2/2] tests: avoid using the branch name `main` Johannes Schindelin via GitGitGadget

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