Re: [PATCH] format-patch: introduce format.outputDirectory configuration

2015-06-19 Thread Alexander Kuleshov
Hello Jeff and Junio, Thank you for feedback and help. I think also I need to add yet another test which tests case when configuration option is set and -o passed. I'll make changes and resend the patch. Thank you. 2015-06-19 10:14 GMT+06:00 Jeff King p...@peff.net: On Thu, Jun 18, 2015 at

Re: [PATCH] format-patch: introduce format.outputDirectory configuration

2015-06-19 Thread Alexander Kuleshov
2015-06-19 3:46 GMT+06:00 Junio C Hamano gits...@pobox.com: I agree with later -o should override an earlier one, but I do not necessarily agree with '-o -' should be --stdout, for a simple reason that -o foo is not --stdout foo. Perhaps something like this to replace builtin/ part of

Re: [PATCH] format-patch: introduce format.outputDirectory configuration

2015-06-19 Thread Junio C Hamano
Alexander Kuleshov kuleshovm...@gmail.com writes: 2015-06-19 3:46 GMT+06:00 Junio C Hamano gits...@pobox.com: I agree with later -o should override an earlier one, but I do not necessarily agree with '-o -' should be --stdout, for a simple reason that -o foo is not --stdout foo. Perhaps

Re: [PATCH] format-patch: introduce format.outputDirectory configuration

2015-06-19 Thread Alexander Kuleshov
I thought I made that if we did not see '-o dir' on the command line, initialize output_directory to what we read from the config before we make a call to set_outdir(). What I am missing? Puzzled... FWIW, IIRC, the patch you are responding to passed the test you added. Ok, Now we have:

Re: [PATCH] format-patch: introduce format.outputDirectory configuration

2015-06-19 Thread Junio C Hamano
Alexander Kuleshov kuleshovm...@gmail.com writes: Ah, you mean to put this check before. I am fuzzy what you mean before (or after); the how about doing it this way instead? patch we are discussing is to replace the change you did in your original, so if you apply it you would know what

Re: [PATCH] format-patch: introduce format.outputDirectory configuration

2015-06-19 Thread Alexander Kuleshov
Ah, you mean to put this check before. Just tested it and many tests are broken. Will look on it now 2015-06-19 23:19 GMT+06:00 Alexander Kuleshov kuleshovm...@gmail.com: I thought I made that if we did not see '-o dir' on the command line, initialize output_directory to what we read from the

[PATCH] format-patch: introduce format.outputDirectory configuration

2015-06-18 Thread Alexander Kuleshov
We can pass -o/--output-directory to the format-patch command to store patches not in the working directory. This patch introduces format.outputDirectory configuration option for same purpose. The case of usage of this configuration option can be convinience to not pass everytime

Re: [PATCH] format-patch: introduce format.outputDirectory configuration

2015-06-18 Thread Junio C Hamano
Alexander Kuleshov kuleshovm...@gmail.com writes: diff --git a/Documentation/config.txt b/Documentation/config.txt index fd2036c..8f6f7ed 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -1247,6 +1247,10 @@ format.coverLetter:: format-patch is invoked, but in

Re: [PATCH] format-patch: introduce format.outputDirectory configuration

2015-06-18 Thread Jeff King
On Thu, Jun 18, 2015 at 02:46:36PM -0700, Junio C Hamano wrote: If I were designing from scratch, I would consider making -o - output to stdout, and letting it override a previous -o (or vice versa). We could still do that (and make --stdout an alias for that), but I don't know if it is

Re: [PATCH] format-patch: introduce format.outputDirectory configuration

2015-06-18 Thread Jeff King
On Thu, Jun 18, 2015 at 10:13:37AM -0700, Junio C Hamano wrote: -static const char *set_outdir(const char *prefix, const char *output_directory) +static const char *set_outdir(const char *prefix, const char *output_directory, + const char

Re: [PATCH] format-patch: introduce format.outputDirectory configuration

2015-06-18 Thread Junio C Hamano
Junio C Hamano gits...@pobox.com writes: Jeff King p...@peff.net writes: This change looks ugly and unnecessary. All the machinery after and including the point set_outdir() is called, including reopen_stdout(), work on output_directory variable and only that variable. Wouldn't it work

Re: [PATCH] format-patch: introduce format.outputDirectory configuration

2015-06-18 Thread Jeff King
On Thu, Jun 18, 2015 at 01:06:54PM -0700, Junio C Hamano wrote: Don't we load the config before parsing options here? In that case, we can use our usual strategy to just set output_directory (which is already a static global) from the config callback, and everything Just Works. We do

Re: [PATCH] format-patch: introduce format.outputDirectory configuration

2015-06-18 Thread Junio C Hamano
Jeff King p...@peff.net writes: This change looks ugly and unnecessary. All the machinery after and including the point set_outdir() is called, including reopen_stdout(), work on output_directory variable and only that variable. Wouldn't it work equally well to have if

Re: [PATCH] format-patch: introduce format.outputDirectory configuration

2015-06-18 Thread Jeff King
On Thu, Jun 18, 2015 at 04:13:23PM -0400, Jeff King wrote: You would also need to remove the oh you gave me -o twice? check, and change the semantics to later -o overrides an earlier one, wouldn't you? Otherwise you would never be able to override what you read from the config, I am

Re: [PATCH] format-patch: introduce format.outputDirectory configuration

2015-06-18 Thread Junio C Hamano
Jeff King p...@peff.net writes: Much worse, though, is that we also have to interact with --stdout. We currently treat --stdout -o foo as an error; you need a separate config_output_directory to continue to handle that (and allow --stdout to override the config). If I were designing from