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

2015-06-19 Thread Junio C Hamano
Alexander Kuleshov 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 addition goes to where

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

2015-06-19 Thread Alexander Kuleshov
Sorry for the noise guys, was my fault. Junio, now all is working and I'm going to send v2. How to send it better in one patch or separate patches for the documentation, tests and etc..? Thank you. -- To unsubscribe from this list: send the line "unsubscribe git" in

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 : >> 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 w

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 w

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

2015-06-19 Thread Junio C Hamano
Alexander Kuleshov writes: > 2015-06-19 3:46 GMT+06:00 Junio C Hamano : >> 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

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 : > 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 Alexander's

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

2015-06-19 Thread Alexander Kuleshov
Hello, Yes, thank you for advice. 2015-06-19 17:34 GMT+06:00 Remi Galan Alfonso : > Alexander Kuleshov writes: >> +test_expect_success "format-patch format.outputDirectory option" ' >> + git config format.outputDirectory "patches/" && >> + git format-patch master..side && >> + cnt=$(ls | wc -l)

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

2015-06-19 Thread Remi Galan Alfonso
Alexander Kuleshov writes: > +test_expect_success "format-patch format.outputDirectory option" ' > + git config format.outputDirectory "patches/" && > + git format-patch master..side && > + cnt=$(ls | wc -l) && > + echo $cnt && > + test $cnt = 3 && > + git config --unset format.outputDirectory > +

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 : > On Thu, Jun 18, 2015 at 02:46:36PM -07

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 > > kn

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

2015-06-18 Thread Junio C Hamano
Jeff King 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 scra

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 th

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.

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

2015-06-18 Thread Junio C Hamano
Junio C Hamano writes: > Jeff King 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

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

2015-06-18 Thread Junio C Hamano
Jeff King 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 (!output_dir

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 *config_outpu

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

2015-06-18 Thread Junio C Hamano
Alexander Kuleshov 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 addition can be set

[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 -o/--output-direc