From: Jacob Keller <jacob.keller@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Jacob Keller <jacob.e.keller@intel.com>,
Git mailing list <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>,
Christian Couder <christian.couder@gmail.com>
Subject: Re: [PATCH] diff: add test showing regression to --relative
Date: Wed, 6 Dec 2017 17:21:57 -0800 [thread overview]
Message-ID: <CA+P7+xr8KobkY56-4qE4ZdVgC388L6=NKQc=3kTZvWz8XOD3ag@mail.gmail.com> (raw)
In-Reply-To: <20171207010421.GC1975@sigill.intra.peff.net>
On Wed, Dec 6, 2017 at 5:04 PM, Jeff King <peff@peff.net> wrote:
> On Wed, Dec 06, 2017 at 04:35:17PM -0800, Jacob Keller wrote:
>
>> Subject: [PATCH] diff: add test showing regression to --relative
>
> Since we'd hopefully not ever merge that regression, I think this patch
> ought to stand on its own. In which case it probably wants to say
> something like:
>
> diff: test --relative without a prefix
>
> We already test "diff --relative=subdir", but not that
> "--relative" by itself should use the current directory as
> its prefix.
>
Yea, I wasn't sure what the actual status of the changes were though,
so I thought I'd send the actual fix I did. It's definitely up to
Christian in determining what he thinks the best path forward is.
>> diff --git a/t/t4045-diff-relative.sh b/t/t4045-diff-relative.sh
>> index 3950f5034d31..41e4f59b2ffb 100755
>> --- a/t/t4045-diff-relative.sh
>> +++ b/t/t4045-diff-relative.sh
>> @@ -70,4 +70,9 @@ for type in diff numstat stat raw; do
>> check_$type dir/file2 --relative=sub
>> done
>>
>> +cd subdir
>> +for type in diff numstat stat raw; do
>> + check_$type file2 --relative
>> +done
>
> We should avoid moving the cwd of the whole test script in
> case we add tests later. Normally we'd do the cd inside a
> subshell, but that's complicated by the wrapper (we wouldn't
> want to increment the test counter just inside the subshell,
> for instance).
>
> Adding "cd .." is the smallest thing we could do to fix
> that. But I think the more robust solution is to actually
> teach the check_* helper about doing the "cd" inside the
> test_expect block. Or just pushing the helper down into the
> test block and living with repeating the
> "test_expect_success" parts for each call.
Yea, I tried cd inside the subshell and it didn't work, so I did this
as the quicker solution.
I think the best method would be to update the check_* helper
functions to take a dir parameter, and use that to do git -C "dir"
when calling the diff commands.
Thanks,
Jake
>
> -Peff
next prev parent reply other threads:[~2017-12-07 1:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-07 0:35 [PATCH] diff: add test showing regression to --relative Jacob Keller
2017-12-07 1:04 ` Jeff King
2017-12-07 1:21 ` Jacob Keller [this message]
2017-12-07 17:30 ` [PATCH v2 0/7] reroll of cc/skip-to-optional-val Junio C Hamano
2017-12-07 17:30 ` [PATCH v2 5/7] diff: use skip-to-optional-val in parsing --relative Junio C Hamano
2017-12-07 19:03 ` Jacob Keller
2017-12-07 21:11 ` Jeff King
2017-12-07 21:59 ` Junio C Hamano
2017-12-07 22:21 ` Jeff King
2017-12-07 22:31 ` Junio C Hamano
2017-12-08 9:05 ` Jeff King
2017-12-08 21:09 ` Junio C Hamano
2017-12-07 17:30 ` [PATCH v2 6/7] t4045: reindent to make helpers readable Junio C Hamano
2017-12-07 17:30 ` [PATCH v2 7/7] t4045: test 'diff --relative' for real Junio C Hamano
2017-12-07 19:06 ` Jacob Keller
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CA+P7+xr8KobkY56-4qE4ZdVgC388L6=NKQc=3kTZvWz8XOD3ag@mail.gmail.com' \
--to=jacob.keller@gmail.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jacob.e.keller@intel.com \
--cc=peff@peff.net \
/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.
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).