Re: [PATCH] Introduce a hook to run after formatting patches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stefan Beller <sbeller@xxxxxxxxxx> 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.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]