From: Junio C Hamano <gitster@pobox.com>
To: "René Scharfe" <l.s.r@web.de>
Cc: lolligerhans@gmx.de, git@vger.kernel.org
Subject: Re: [PATCH] diff: allow --color-moved with --no-ext-diff
Date: Mon, 24 Jun 2024 09:21:15 -0700 [thread overview]
Message-ID: <xmqqsex2cnwk.fsf@gitster.g> (raw)
In-Reply-To: <8a8bd51e-9ce5-4a68-bfbe-f16dcbb7e89c@web.de> ("René Scharfe"'s message of "Sat, 22 Jun 2024 21:41:30 +0200")
René Scharfe <l.s.r@web.de> writes:
> diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh
> index b443626afd..a1478680b6 100755
> --- a/t/t4015-diff-whitespace.sh
> +++ b/t/t4015-diff-whitespace.sh
> @@ -1184,6 +1184,15 @@ test_expect_success 'detect moved code, complete file' '
> test_cmp expected actual
> '
>
> +test_expect_success '--color-moved with --no-ext-diff' '
> + test_config color.diff.oldMoved "normal red" &&
> + test_config color.diff.newMoved "normal green" &&
We are making sure we won't be affected by previous tests. We
assume that we did not set color.diff.{old,new} to these two colors,
but that would be an OK assumption to make.
> + cp actual.raw expect &&
But then this introduces a dependence to an earlier _specific_ test,
the one that created this version (among three) of actual.raw;
If we did this instead
git diff --color --color-moved=zebra --no-renames HEAD >expect &&
it would make this a lot more self-contained.
> + git -c diff.external=false diff HEAD --no-ext-diff \
> + --color-moved=zebra --color --no-renames >actual &&
Also, please do stick to the normal CLI ocnvention, dashed options
come before the revs, i.e.
git -c diff.external=false diff --no-ext-diff --color \
--color-moved=zebra --no-renames HEAD >actual &&
Our tests shouldn't be setting a wrong example.
> + test_cmp expect actual
> +'
> +
> test_expect_success 'detect malicious moved code, inside file' '
> test_config color.diff.oldMoved "normal red" &&
> test_config color.diff.newMoved "normal green" &&
Other than that, looking very good.
Thanks.
next prev parent reply other threads:[~2024-06-24 16:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-22 10:01 Bug: diff.external --no-ext-diff suppresses --color-moved lolligerhans
2024-06-22 19:41 ` [PATCH] diff: allow --color-moved with --no-ext-diff René Scharfe
2024-06-23 9:17 ` Aw: " lolligerhans
2024-06-23 9:46 ` René Scharfe
2024-06-24 16:21 ` Junio C Hamano [this message]
2024-06-24 19:15 ` René Scharfe
2024-06-25 0:39 ` Junio C Hamano
2024-06-24 19:15 ` [PATCH v2] " René Scharfe
2024-06-24 20:53 ` 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=xmqqsex2cnwk.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=l.s.r@web.de \
--cc=lolligerhans@gmx.de \
/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.