diff mbox series

[07/10] t3200: prepare for `main` being shorter than `master`

Message ID e1740bb7d7d8c90db68ffff443b69894177e36f3.1603135903.git.gitgitgadget@gmail.com (mailing list archive)
State New, archived
Headers show
Series None | expand

Commit Message

Johannes Schindelin Oct. 19, 2020, 7:31 p.m. UTC
From: Johannes Schindelin <johannes.schindelin@gmx.de>

In the test case adjusted by this patch, we want to cut just after the
longest shown ref name. Since `main` is shorter than `master`, we need
to decrease the number of characters. Since `main2` is shown, too, and
since that is only one character shorter than `master`, we decrement the
length by one.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t3200-branch.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Junio C Hamano Oct. 21, 2020, 10:39 p.m. UTC | #1
"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
writes:

> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> In the test case adjusted by this patch, we want to cut just after the
> longest shown ref name. Since `main` is shorter than `master`, we need
> to decrease the number of characters. Since `main2` is shown, too, and
> since that is only one character shorter than `master`, we decrement the
> length by one.

Confused.  I do not see 'main2' (or 'master2' for that matter) in
the test script.

If we rename 'topic' to 'topico', then we'd still show branches, the
longest among which has 6 characters (the same as 'master'), so we
won't have to wonder where 'main2' came from; I guess that is another
way to solve this.



>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  t/t3200-branch.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
> index 6efe7a44bc..55b24b76ce 100755
> --- a/t/t3200-branch.sh
> +++ b/t/t3200-branch.sh
> @@ -375,9 +375,9 @@ test_expect_success 'git branch --column -v should fail' '
>  	test_must_fail git branch --column -v
>  '
>  
> -test_expect_success 'git branch -v with column.ui ignored' '
> +test_expect_success PREPARE_FOR_MAIN_BRANCH 'git branch -v with column.ui ignored' '
>  	git config column.ui column &&
> -	COLUMNS=80 git branch -v | cut -c -9 | sed "s/ *$//" >actual &&
> +	COLUMNS=80 git branch -v | cut -c -8 | sed "s/ *$//" >actual &&
>  	git config --unset column.ui &&
>  	cat >expect <<\EOF &&
>    a/b/c
Johannes Schindelin Oct. 22, 2020, 1:08 p.m. UTC | #2
Hi Junio,

On Wed, 21 Oct 2020, Junio C Hamano wrote:

> "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
> writes:
>
> > From: Johannes Schindelin <johannes.schindelin@gmx.de>
> >
> > In the test case adjusted by this patch, we want to cut just after the
> > longest shown ref name. Since `main` is shorter than `master`, we need
> > to decrease the number of characters. Since `main2` is shown, too, and
> > since that is only one character shorter than `master`, we decrement the
> > length by one.
>
> Confused.  I do not see 'main2' (or 'master2' for that matter) in
> the test script.

Oops. Yes, this is a left-over from the time when I had renamed the
branches from `master2` to `main2` (and based on your advice, I had
changed those patches to rename to `topic` instead).

> If we rename 'topic' to 'topico', then we'd still show branches, the
> longest among which has 6 characters (the same as 'master'), so we
> won't have to wonder where 'main2' came from; I guess that is another
> way to solve this.

Sure, but then, that would adjust a perfectly nice name to a not-so-nice
name just to avoid changing the number of columns to cut.

If you don't mind, I would like to stay on `topic` ;-)

Ciao,
Dscho
diff mbox series

Patch

diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index 6efe7a44bc..55b24b76ce 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -375,9 +375,9 @@  test_expect_success 'git branch --column -v should fail' '
 	test_must_fail git branch --column -v
 '
 
-test_expect_success 'git branch -v with column.ui ignored' '
+test_expect_success PREPARE_FOR_MAIN_BRANCH 'git branch -v with column.ui ignored' '
 	git config column.ui column &&
-	COLUMNS=80 git branch -v | cut -c -9 | sed "s/ *$//" >actual &&
+	COLUMNS=80 git branch -v | cut -c -8 | sed "s/ *$//" >actual &&
 	git config --unset column.ui &&
 	cat >expect <<\EOF &&
   a/b/c