git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rubén Justo" <rjusto@gmail.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Git List <git@vger.kernel.org>,
	Bagas Sanjaya <bagasdotme@gmail.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v3] branch: description for non-existent branch errors
Date: Sat, 8 Oct 2022 10:54:12 +0200	[thread overview]
Message-ID: <7a332503-d267-6d2c-c2bd-d072411ca408@gmail.com> (raw)
In-Reply-To: <CAPig+cT+Yeh95p-2PgMDYz+_AxeEA72i-zLuQu11QEyWAt8kiA@mail.gmail.com>


On 8/10/22 5:27, Eric Sunshine wrote:
> On Fri, Oct 7, 2022 at 8:49 PM Rubén Justo <rjusto@gmail.com> wrote:
>> [...]
>> Make the error descriptions for those branch operations with unborn or
>> non-existent branches, more informative.
>> [...]
>> Signed-off-by: Rubén Justo <rjusto@gmail.com>
>> ---
>> diff --git a/t/t3202-show-branch.sh b/t/t3202-show-branch.sh
>> @@ -7,6 +7,28 @@ test_description='test show-branch'
>> +test_expect_success 'error descriptions on empty repository' '
>> +       current=$(git branch --show-current) &&
>> +       cat >expect <<-EOF &&
>> +       error: No commit on branch '\''$current'\'' yet.
>> +       EOF
> 
> It's a matter of taste, but leaving and re-entering the single-quoted
> context, along with escaping, can make for a difficult read. You could
> instead take advantage of the SQ variable already defined by the test
> scripts:
> 
>     echo "error: No commit on branch $SQ$current$SQ yet." >expect &&
> 
> Not worth a re-roll, of course.
> 
>> +test_expect_success 'fatal descriptions on empty repository' '
>> +       current=$(git branch --show-current) &&
>> +       cat >expect <<-EOF &&
>> +       fatal: No commit on branch '\''$current'\'' yet.
>> +       EOF
> 
> Ditto.

Thanks, I didn't know about $SQ.

	'\''$current'\'' vs $SQ$current$SQ vs ${SQ}$current${SQ}

I also find ugly that escaping, but I think is harder to read and
error prone to use $SQ here.. :-/


  reply	other threads:[~2022-10-08  8:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22 22:37 [PATCH] branch: description for non-existent branch errors Rubén Justo
2022-09-24 22:52 ` Rubén Justo
2022-09-26 18:12   ` Junio C Hamano
2022-09-26 23:35     ` Rubén Justo
2022-09-27 22:24       ` Junio C Hamano
2022-09-28 17:41         ` Junio C Hamano
2022-09-28 17:50         ` Junio C Hamano
2022-09-28 23:59           ` Rubén Justo
2022-09-29  1:56             ` Junio C Hamano
2022-09-30 22:47 ` [PATCH v2] " Rubén Justo
2022-10-01 12:43   ` Bagas Sanjaya
2022-10-02 21:28     ` Rubén Justo
2022-10-08  0:39   ` [PATCH v3] " Rubén Justo
2022-10-08  3:27     ` Eric Sunshine
2022-10-08  8:54       ` Rubén Justo [this message]
2022-10-09  5:05         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7a332503-d267-6d2c-c2bd-d072411ca408@gmail.com \
    --to=rjusto@gmail.com \
    --cc=bagasdotme@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).