All of lore.kernel.org
 help / color / mirror / Atom feed
From: "René Scharfe" <l.s.r@web.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Ramsay Jones <ramsay@ramsayjones.plus.com>
Subject: Re: [PATCH v2 1/8] t4051: rewrite, add more tests
Date: Mon, 30 May 2016 22:55:35 +0200	[thread overview]
Message-ID: <574CA8C7.8070807@web.de> (raw)
In-Reply-To: <xmqqinxwpgfn.fsf@gitster.mtv.corp.google.com>

Am 30.05.2016 um 01:55 schrieb Junio C Hamano:
> René Scharfe <l.s.r@web.de> writes:
>
>> +commit_and_tag () {
>> +	message=$1 &&
>> +	shift &&
>> +	git add $@ &&
>
> Lack of dq around $@ makes me wonder if there is something funny
> going on (looking at the callers, there isn't, so we'd better quote
> it to avoid wasting time, I think).

OK.

>> +	test_tick &&
>> +	git commit -m $message &&
>> +	git tag $message
>>   }
>
> The use of $message as the sole argument to "git tag" makes the
> readers guess that it must be a single token without any funny
> character, so the readers would probably do not waste too much time
> wondreing if the lack of dq around $message in the last two is
> problematic.

Well, let's call it $tag; $message is a bit misleading here.  The saved 
letters can be invested in quotes. ;)

>> +last_context_line () {
>> +	sed -n '$ p'
>>   }
>
> I have a vague recollection that some implementations of sed are
> unhappy to see that space between the address and the operation; I'd
> feel safer without it.

Indeed most sed calls in t/ have no space there (found counter-examples 
only in annotate-tests.sh, t4201-shortlog.sh, t9824-git-p4-git-lfs.sh).

>> +check_diff () {
>> +	name=$1
>> +	desc=$2
>> +	options="-W $3"
>> +
>> +	test_expect_success "$desc" '
>> +		git diff $options "$name^" "$name" >"$name.diff"
>> +	'
>> +
>> +	test_expect_success ' diff applies' '
>> +		test_when_finished "git reset --hard" &&
>> +		git checkout --detach "$name^" &&
>
> With the presence of ^ there, --detach is unnecessary; it would not
> hurt, though.

Right.  It's just there to make that intent clear.

>> +		git apply "$name.diff" &&
>> +		git diff --exit-code "$name"
>
> Even though we may know that $name.diff" will never have a creation
> of new paths, I'd feel safer if "apply" is run with "--index".

Makes sense; the less we assume about the diff to be checked the better.

Thanks a lot!

René

  reply	other threads:[~2016-05-30 20:57 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-10 21:51 [Bug?] log -p -W showing the whole file for a patch that adds to the end? Junio C Hamano
2016-05-10 22:51 ` Junio C Hamano
2016-05-12 22:12   ` René Scharfe
2016-05-21 18:42   ` René Scharfe
2016-05-21 18:45     ` [PATCH 1/5] diff: factor out match_func_rec() René Scharfe
2016-05-21 18:45     ` [PATCH 2/5] diff: handle appended chunks better with -W René Scharfe
2016-05-21 18:46     ` [PATCH 3/5] diff: ignore empty lines before added functions " René Scharfe
2016-05-21 18:46     ` [PATCH 4/5] diff: don't include common trailing empty lines " René Scharfe
2016-05-21 18:47     ` [PATCH 5/5] grep: don't extend context to " René Scharfe
2016-05-24 18:16     ` [Bug?] log -p -W showing the whole file for a patch that adds to the end? Junio C Hamano
2016-05-26  8:54       ` René Scharfe
2016-05-26 17:05         ` Junio C Hamano
2016-05-27 17:13           ` René Scharfe
2016-05-28 14:46     ` René Scharfe
2016-05-28 14:57       ` [PATCH v2 1/8] t4051: rewrite, add more tests René Scharfe
2016-05-29 23:55         ` Junio C Hamano
2016-05-30 20:55           ` René Scharfe [this message]
2016-05-31 20:00           ` [PATCH v2.5 " René Scharfe
2016-05-31 20:15             ` René Scharfe
2016-05-31 21:23             ` Junio C Hamano
2016-05-28 14:58       ` [PATCH v2 2/8] xdiff: factor out match_func_rec() René Scharfe
2016-05-28 15:00       ` [PATCH v2 3/8] xdiff: handle appended chunks better with -W René Scharfe
2016-05-28 15:02       ` [PATCH v2 4/8] xdiff: ignore empty lines before added functions " René Scharfe
2016-05-28 15:03       ` [PATCH v2 5/8] xdiff: -W: don't include common trailing empty lines in context René Scharfe
2016-05-28 15:04       ` [PATCH v2 6/8] xdiff: don't trim common tail with -W René Scharfe
2016-05-28 15:05       ` [PATCH v2 7/8] t7810: add test for grep -W and trailing empty context lines René Scharfe
2016-05-28 15:06       ` [PATCH v2 8/8] grep: -W: don't extend context to trailing empty lines René Scharfe

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=574CA8C7.8070807@web.de \
    --to=l.s.r@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=ramsay@ramsayjones.plus.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.