]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t3200: avoid variations of the `master` branch name
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Mon, 21 Sep 2020 22:01:24 +0000 (22:01 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 21 Sep 2020 22:19:28 +0000 (15:19 -0700)
To avoid branch names with a loaded history, we already started to avoid
using the name "master" in a couple instances.

The `t3200-branch.sh` script uses variations of this name for branches
other than the default one. So let's change those names, as
"lowest-hanging fruits" in the effort to use more inclusive naming
throughout Git's source code. While at it, make those branch names
independent from the default branch name.

In this particular instance, this rename requires a couple of
non-trivial adjustments, as the aligned output depends on the maximum
length of the displayed branches (which we now changed), and also on the
alphabetical order (which we now changed, too).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3200-branch.sh

index 028c88d1b24efc945fb605360eda51a86f60bd36..79b6027ab08b39c2c30a7506180a74740fa3fd41 100755 (executable)
@@ -234,10 +234,10 @@ test_expect_success 'git branch -M master master should work when master is chec
        git branch -M master master
 '
 
-test_expect_success 'git branch -M master2 master2 should work when master is checked out' '
+test_expect_success 'git branch -M topic topic should work when master is checked out' '
        git checkout master &&
-       git branch master2 &&
-       git branch -M master2 master2
+       git branch topic &&
+       git branch -M topic topic
 '
 
 test_expect_success 'git branch -v -d t should work' '
@@ -324,8 +324,8 @@ test_expect_success 'git branch --list -v with --abbrev' '
 test_expect_success 'git branch --column' '
        COLUMNS=81 git branch --column=column >actual &&
        cat >expect <<\EOF &&
-  a/b/c     bam       foo       l       * master    mb        o/o       q
-  abc       bar       j/k       m/m       master2   n         o/p       r
+  a/b/c    bam      foo      l      * master   n        o/p      r
+  abc      bar      j/k      m/m      mb       o/o      q        topic
 EOF
        test_cmp expect actual
 '
@@ -346,13 +346,13 @@ test_expect_success 'git branch --column with an extremely long branch name' '
   l
   m/m
 * master
-  master2
   mb
   n
   o/o
   o/p
   q
   r
+  topic
   $long
 EOF
        test_cmp expect actual
@@ -365,8 +365,8 @@ test_expect_success 'git branch with column.*' '
        git config --unset column.branch &&
        git config --unset column.ui &&
        cat >expect <<\EOF &&
-  a/b/c   bam   foo   l   * master    mb   o/o   q
-  abc     bar   j/k   m/m   master2   n    o/p   r
+  a/b/c   bam   foo   l   * master   n     o/p   r
+  abc     bar   j/k   m/m   mb       o/o   q     topic
 EOF
        test_cmp expect actual
 '
@@ -377,7 +377,7 @@ test_expect_success 'git branch --column -v should fail' '
 
 test_expect_success 'git branch -v with column.ui ignored' '
        git config column.ui column &&
-       COLUMNS=80 git branch -v | cut -c -10 | sed "s/ *$//" >actual &&
+       COLUMNS=80 git branch -v | cut -c -9 | sed "s/ *$//" >actual &&
        git config --unset column.ui &&
        cat >expect <<\EOF &&
   a/b/c
@@ -389,13 +389,13 @@ test_expect_success 'git branch -v with column.ui ignored' '
   l
   m/m
 * master
-  master2
   mb
   n
   o/o
   o/p
   q
   r
+  topic
 EOF
        test_cmp expect actual
 '
@@ -597,10 +597,10 @@ test_expect_success 'git branch -C master master should work when master is chec
        git branch -C master master
 '
 
-test_expect_success 'git branch -C master5 master5 should work when master is checked out' '
+test_expect_success 'git branch -C main5 main5 should work when master is checked out' '
        git checkout master &&
-       git branch master5 &&
-       git branch -C master5 master5
+       git branch main5 &&
+       git branch -C main5 main5
 '
 
 test_expect_success 'git branch -C ab cd should overwrite existing config for cd' '
@@ -711,11 +711,11 @@ test_expect_success 'deleting a self-referential symref' '
 '
 
 test_expect_success 'renaming a symref is not allowed' '
-       git symbolic-ref refs/heads/master2 refs/heads/master &&
-       test_must_fail git branch -m master2 master3 &&
-       git symbolic-ref refs/heads/master2 &&
+       git symbolic-ref refs/heads/topic refs/heads/master &&
+       test_must_fail git branch -m topic new-topic &&
+       git symbolic-ref refs/heads/topic &&
        test_path_is_file .git/refs/heads/master &&
-       test_path_is_missing .git/refs/heads/master3
+       test_path_is_missing .git/refs/heads/new-topic
 '
 
 test_expect_success SYMLINKS 'git branch -m u v should fail when the reflog for u is a symlink' '