All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Beller <sbeller@google.com>
To: Brandon Williams <bmwill@google.com>,
	Michael J Gruber <git@drmicha.warpmail.net>
Cc: git <git@vger.kernel.org>, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v2 3/4] diff: add flag to indicate textconv was set via cmdline
Date: Mon, 30 Oct 2017 13:41:29 -0700	[thread overview]
Message-ID: <CAGZ79kaLX881vi3MJaOCE6h=h_eRGjJ+gYCUEV-2rNSg0exFOw@mail.gmail.com> (raw)
In-Reply-To: <20171030194646.27473-4-bmwill@google.com>

On Mon, Oct 30, 2017 at 12:46 PM, Brandon Williams <bmwill@google.com> wrote:
> git-show is unique in that it wants to use textconv by default except
> for when it is showing blobs.  When asked to show a blob, show doesn't
> want to use textconv unless the user explicitly requested that it be
> used by providing the command line flag '--textconv'.
>
> Currently this is done by using a parallel set of 'touched' flags which
> get set every time a particular flag is set or cleared.  In a future
> patch we want to eliminate this parallel set of flags so instead of
> relying on if the textconv flag has been touched, add a new flag
> 'TEXTCONV_SET_VIA_CMDLINE' which is only set if textconv is requested
> via the command line.

Is it worth mentioning 4197361e39 (Merge branch 'mg/more-textconv',
2013-10-23), that introduced the touched_flags?
(+cc Michael Gruber FYI)

> Signed-off-by: Brandon Williams <bmwill@google.com>
> ---
>  builtin/log.c | 2 +-
>  diff.c        | 8 +++++---
>  diff.h        | 1 +
>  3 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/builtin/log.c b/builtin/log.c
> index dc28d43eb..82131751d 100644
> --- a/builtin/log.c
> +++ b/builtin/log.c
> @@ -485,7 +485,7 @@ static int show_blob_object(const struct object_id *oid, struct rev_info *rev, c
>         unsigned long size;
>
>         fflush(rev->diffopt.file);
> -       if (!DIFF_OPT_TOUCHED(&rev->diffopt, ALLOW_TEXTCONV) ||
> +       if (!DIFF_OPT_TST(&rev->diffopt, TEXTCONV_SET_VIA_CMDLINE) ||
>             !DIFF_OPT_TST(&rev->diffopt, ALLOW_TEXTCONV))
>                 return stream_blob_to_fd(1, oid, NULL, 0);
>
> diff --git a/diff.c b/diff.c
> index 3ad9c9b31..8b700b1bd 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -4762,11 +4762,13 @@ int diff_opt_parse(struct diff_options *options,
>                 DIFF_OPT_SET(options, ALLOW_EXTERNAL);
>         else if (!strcmp(arg, "--no-ext-diff"))
>                 DIFF_OPT_CLR(options, ALLOW_EXTERNAL);
> -       else if (!strcmp(arg, "--textconv"))
> +       else if (!strcmp(arg, "--textconv")) {
>                 DIFF_OPT_SET(options, ALLOW_TEXTCONV);
> -       else if (!strcmp(arg, "--no-textconv"))
> +               DIFF_OPT_SET(options, TEXTCONV_SET_VIA_CMDLINE);
> +       } else if (!strcmp(arg, "--no-textconv")) {
>                 DIFF_OPT_CLR(options, ALLOW_TEXTCONV);

Also clear TEXTCONV_SET_VIA_CMDLINE here?
(`git show --textconv --no-textconv` might act funny?)

> -       else if (!strcmp(arg, "--ignore-submodules")) {
> +               DIFF_OPT_CLR(options, TEXTCONV_SET_VIA_CMDLINE);
> +       } else if (!strcmp(arg, "--ignore-submodules")) {
>                 DIFF_OPT_SET(options, OVERRIDE_SUBMODULE_CONFIG);
>                 handle_ignore_submodules_arg(options, "all");
>         } else if (skip_prefix(arg, "--ignore-submodules=", &arg)) {
> diff --git a/diff.h b/diff.h
> index 47e6d43cb..4eaf9b370 100644
> --- a/diff.h
> +++ b/diff.h
> @@ -83,6 +83,7 @@ struct diff_flags {
>         unsigned DIRSTAT_CUMULATIVE:1;
>         unsigned DIRSTAT_BY_FILE:1;
>         unsigned ALLOW_TEXTCONV:1;
> +       unsigned TEXTCONV_SET_VIA_CMDLINE:1;
>         unsigned DIFF_FROM_CONTENTS:1;
>         unsigned DIRTY_SUBMODULES:1;
>         unsigned IGNORE_UNTRACKED_IN_SUBMODULES:1;
> --
> 2.15.0.403.gc27cc4dac6-goog
>

  reply	other threads:[~2017-10-30 20:41 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-27 22:28 [PATCH 0/3] convert diff flags to be stored in a struct Brandon Williams
2017-10-27 22:28 ` [PATCH 1/3] add: use DIFF_OPT_SET macro to set a diff flag Brandon Williams
2017-10-27 22:28 ` [PATCH 2/3] reset: " Brandon Williams
2017-10-29  1:26   ` Junio C Hamano
2017-10-30 18:06     ` Brandon Williams
2017-10-27 22:28 ` [PATCH 3/3] diff: convert flags to be stored in bitfields Brandon Williams
2017-10-29  1:55   ` Junio C Hamano
2017-10-30  0:29     ` Junio C Hamano
2017-10-30 19:39       ` Brandon Williams
2017-10-31  2:49       ` Junio C Hamano
2017-10-30 17:49     ` Brandon Williams
2017-10-29  1:22 ` [PATCH 0/3] convert diff flags to be stored in a struct Junio C Hamano
2017-10-29  4:37   ` Stefan Beller
2017-10-30 19:46 ` [PATCH v2 0/4] " Brandon Williams
2017-10-30 19:46   ` [PATCH v2 1/4] add, reset: use DIFF_OPT_SET macro to set a diff flag Brandon Williams
2017-10-30 19:46   ` [PATCH v2 2/4] diff: convert flags to be stored in bitfields Brandon Williams
2017-10-31  4:41     ` Junio C Hamano
2017-10-31  5:23     ` [PATCH 2.5/4] diff: avoid returning a struct by value from diff_flags_or() Junio C Hamano
2017-10-31 17:51       ` Brandon Williams
2017-10-30 19:46   ` [PATCH v2 3/4] diff: add flag to indicate textconv was set via cmdline Brandon Williams
2017-10-30 20:41     ` Stefan Beller [this message]
2017-10-30 20:44       ` Brandon Williams
2017-10-30 20:48         ` Brandon Williams
2017-10-31  5:02     ` Junio C Hamano
2017-10-31  5:23     ` [PATCH 3.5/4] diff: set TEXTCONV_VIA_CMDLINE only when it is set to true Junio C Hamano
2017-10-31 17:55       ` Brandon Williams
2017-10-30 19:46   ` [PATCH v2 4/4] diff: remove touched flags Brandon Williams
2017-10-30 22:19   ` [PATCH v2 5/4] diff: remove DIFF_OPT_TST macro Brandon Williams
2017-10-30 22:19     ` [PATCH v2 6/4] diff: remove DIFF_OPT_SET macro Brandon Williams
2017-10-30 22:19     ` [PATCH v2 7/4] diff: remove DIFF_OPT_CLR macro Brandon Williams
2017-10-30 22:19     ` [PATCH v2 8/4] diff: make struct diff_flags members lowercase Brandon Williams
2017-10-31 18:19   ` [PATCH v3 0/8] convert diff flags to be stored in a struct Brandon Williams
2017-10-31 18:19     ` [PATCH v3 1/8] add, reset: use DIFF_OPT_SET macro to set a diff flag Brandon Williams
2017-10-31 18:19     ` [PATCH v3 2/8] diff: convert flags to be stored in bitfields Brandon Williams
2017-10-31 21:32       ` Stefan Beller
2017-11-01  1:26         ` Junio C Hamano
2017-11-01 17:11           ` Stefan Beller
2017-10-31 18:19     ` [PATCH v3 3/8] diff: add flag to indicate textconv was set via cmdline Brandon Williams
2017-10-31 18:19     ` [PATCH v3 4/8] diff: remove touched flags Brandon Williams
2017-10-31 18:19     ` [PATCH v3 5/8] diff: remove DIFF_OPT_TST macro Brandon Williams
2017-10-31 18:19     ` [PATCH v3 6/8] diff: remove DIFF_OPT_SET macro Brandon Williams
2017-10-31 18:19     ` [PATCH v3 7/8] diff: remove DIFF_OPT_CLR macro Brandon Williams
2017-10-31 21:44       ` Stefan Beller
2017-11-01  2:52         ` Junio C Hamano
2017-10-31 18:19     ` [PATCH v3 8/8] diff: make struct diff_flags members lowercase Brandon Williams
2017-10-31 21:46     ` [PATCH v3 0/8] convert diff flags to be stored in a struct Stefan Beller
2017-11-01  6:23     ` 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='CAGZ79kaLX881vi3MJaOCE6h=h_eRGjJ+gYCUEV-2rNSg0exFOw@mail.gmail.com' \
    --to=sbeller@google.com \
    --cc=bmwill@google.com \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.