From: Junio C Hamano <gitster@pobox•com>
To: Stefan Beller <sbeller@google•com>
Cc: git@vger•kernel.org
Subject: Re: [PATCH] Introduce a hook to run after formatting patches
Date: Tue, 18 Nov 2014 09:02:59 -0800 [thread overview]
Message-ID: <xmqqoas4wif0.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CAGZ79kZ=1qekoKfY5cwdmDp68oU-poTcc6A4Fa7u5LhwCB5HyQ@mail.gmail.com> (Stefan Beller's message of "Mon, 17 Nov 2014 18:30:00 -0800")
Stefan Beller <sbeller@google•com> writes:
> Do we have similar filters somewhere in place already,
> so I could have a look at the code architecture,
> the api, and how the user would operate that?
The clean/smudge filters interacts with the payload data and the end
user configuration in a similar way, I would say.
> The way you're proposing, doesn't sound as if a hook would be the right
> thing for such filtering.
That depends on how you define "what a hook is", I think.
> The one big thing I liked over the first patch in this thread was
> the 'maintainability', i.e. if it were a hook, I could set that up
> and forget about it. No need to change my behavior in using git,
> but still I have the desired postprocessed results.
In the message you are responding, I said "detect a request to use",
exactly because I wanted to leave it up to you to design what
form(s) that "request detection" takes. One of the forms could be
"a script with this $filename exists in $GIT_DIR/", and the $filname
may be "hooks/format-patch-redaction-filter".
Of course, any "configured into repository" solution must have a
command line override, so the order you would develop this would be:
(0) make the code that interracts with the filter if given by the
user work, without worrying about how the user specifies the
filter.
(1) add a --command-line-option=<filter-name> to trigger the code
you wrote in (0) above.
(2) add a --no-command-line-option to defeat the configured filter,
without worrying about how the user configures. For your new
command line option --frotz, "git cmd --frotz --no-frotz"
should make your cmd refrain from doing frotz.
(3) add configuration variable to point at a filter script,
e.g. "format.redactionFilter"; you must make sure that this is
disabled with "--no-*" you added in (2) above;
(4) perhaps add support for "hooks/format-patch-redaction-filter",
if you strongly feel like it. The user must be able to disable
this with the same "--no-*" added in (2).
I'd say (4) is optional; by the time you reach (3), you already have
the same "write once and forget" capability.
prev parent reply other threads:[~2014-11-18 17:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-15 0:47 [PATCH] Introduce a hook to run after formatting patches Stefan Beller
2014-11-15 10:44 ` Philip Oakley
2014-11-16 18:40 ` Junio C Hamano
2014-11-17 19:01 ` Stefan Beller
2014-11-17 19:06 ` Junio C Hamano
2014-11-17 19:20 ` Junio C Hamano
2014-11-18 6:40 ` Christian Couder
2014-11-20 23:26 ` Stefan Beller
2014-11-20 23:33 ` Junio C Hamano
2014-11-21 4:31 ` Christian Couder
2014-11-18 2:30 ` Stefan Beller
2014-11-18 17:02 ` 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=xmqqoas4wif0.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=sbeller@google$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox