From: Junio C Hamano <gitster@pobox.com>
To: "Andrej Shadura via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org,
"brian m. carlson" <sandals@crustytoothpaste.net>,
Andrej Shadura <andrew.shadura@collabora.co.uk>
Subject: Re: [PATCH v2 0/2] Add --no-filters option to git-add
Date: Sat, 20 Feb 2021 13:34:30 -0800 [thread overview]
Message-ID: <xmqq4ki6a0ex.fsf@gitster.g> (raw)
In-Reply-To: <pull.880.v2.git.1613840865.gitgitgadget@gmail.com> (Andrej Shadura via GitGitGadget's message of "Sat, 20 Feb 2021 17:07:43 +0000")
"Andrej Shadura via GitGitGadget" <gitgitgadget@gmail.com> writes:
> It is possible for a user to disable attribute-based filtering when
> committing by doing one of the following:
>
> * Create .git/info/attributes unapplying all possible transforming
> attributes.
> * Use git hash-object and git update-index to stage files manually.
>
> Doing the former requires keeping an up-to-date list of all attributes which
> can transform files when committing or checking out. Doing the latter is
> difficult, error-prone and slow when done from scripts.
>
> Instead, similarly to git hash-object, --no-filter can be added to git add
> to enable temporarily disabling filtering in an easy to use way.
I think brian's review covered if such a feature is desirable to
sufficient level, and I do not have anything to add in that area,
so I'll limit my comment to the general design and implementation.
In general, think three times before introducing --no-something
option. It often is much cleaner and futureproof if you instead
introduced --something option whose value defaults to true instead,
so that the end-user can say --no-something from the command line.
> - OPT_BOOL( 0 , "no-filters", &no_filters, N_("store file as is without filters")),
> -+ OPT_BIT(0 , "no-filters", &flags, N_("store file as is without filters"),
> ++ OPT_BIT(0, "no-filters", &flags, N_("store file as is without filters"),
> + HASH_RAW),
In other words, these should give "filters" option, and the code
should initialize the flags word with USE_CLEAN_FILTER bit on by
default (the use of "clean" here comes from "clean vs smudge", one
of the pair of filters end-user can customize the path the data
takes going into Git from the outside world; and the "clean" and
"smudge" datapaths also trigger non-custom standard ones like crlf
munging).
That way when a configuration variable support is introduced to
allow the users to say "I by default refuse to use the clean filters
when running 'git add'" by setting say "[add] cleanfilter = false",
the user can override that with "--filters" from the command line
"for just this time". The same goes for an alias that hardcodes
"--no-filters" on the command line, where allowing "--filters" lets
the users override it.
Thanks.
prev parent reply other threads:[~2021-02-20 21:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-19 18:12 [PATCH 0/2] Add --no-filters option to git-add Andrej Shadura via GitGitGadget
2021-02-19 18:12 ` [PATCH 1/2] add: add option --no-filters to disable attribute-based filtering Andrej Shadura via GitGitGadget
2021-02-19 18:12 ` [PATCH 2/2] hash-object: use the new HASH_RAW flag instead of setting path to NULL Andrej Shadura via GitGitGadget
2021-02-19 22:36 ` [PATCH 0/2] Add --no-filters option to git-add brian m. carlson
2021-02-20 8:06 ` Andrej Shadura
2021-02-20 9:30 ` Andrej Shadura
2021-02-20 14:10 ` brian m. carlson
2021-02-20 17:07 ` [PATCH v2 " Andrej Shadura via GitGitGadget
2021-02-20 17:07 ` [PATCH v2 1/2] add: add option --no-filters to disable attribute-based filtering Andrej Shadura via GitGitGadget
2021-02-20 17:07 ` [PATCH v2 2/2] hash-object: use the new HASH_RAW flag instead of setting path to NULL Andrej Shadura via GitGitGadget
2021-02-20 21:34 ` Junio C Hamano [this message]
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=xmqq4ki6a0ex.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=andrew.shadura@collabora.co.uk \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=sandals@crustytoothpaste.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.
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.