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

2015-10-28 Thread Junio C Hamano
Junio C Hamano  writes:

> Looks like there were mostly editorial niggles and no fundamental
> flaws in the design of the patch; it is somewhat a shame to make all
> the efforts go to waste.  Will we be seeing an update soon?

Second ping as I am going through the what's cooking reports and
trying to decide which topics listed in [Stalled] state need to be
discarded from my tree.

Not that my dropping a topic from 'pu' means very much (a dropped
topic can still be submitted and requeued after all), even if you
are no longer interested on the topic, hearing from you would help
others who may be interested in helping the topic to completion.

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


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

2015-09-21 Thread Junio C Hamano
Eric Sunshine  writes:

> On Fri, Jun 19, 2015 at 2:28 PM, Alexander Kuleshov
>  wrote:
>> 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
>
> s/convinience/convenience/
>
>> to not pass everytime -o/--output-directory if an user has pattern
>
> s/everytime/every time/
>
>> to store all patches in the /patches directory for example.
>>
>> The format.outputDirectory has lower priority than command line
>> option, so if user will set format.outputDirectory and pass the
>> command line option, a result will be stored in a directory that
>> passed to command line option.
>>
>> Signed-off-by: Alexander Kuleshov 
>> ---

Looks like there were mostly editorial niggles and no fundamental
flaws in the design of the patch; it is somewhat a shame to make all
the efforts go to waste.  Will we be seeing an update soon?

We are deep in the pre-release feature freeze, so unless you are
participating in regression fixes it is a good time to plan for the
next cycle.

Thanks.

>> +static const char *config_output_directory = NULL;

s/ = NULL;/;/ (do rely on BSS clearing the static variables).
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2015-09-21 Thread Eric Sunshine
On Mon, Sep 21, 2015 at 6:41 PM, Junio C Hamano  wrote:
> Eric Sunshine  writes:
>> On Fri, Jun 19, 2015 at 2:28 PM, Alexander Kuleshov
>>  wrote:
>>> 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
>>
>> s/convinience/convenience/
>>
>>> to not pass everytime -o/--output-directory if an user has pattern
>>
>> s/everytime/every time/
>>
>>> to store all patches in the /patches directory for example.
>>>
>>> The format.outputDirectory has lower priority than command line
>>> option, so if user will set format.outputDirectory and pass the
>>> command line option, a result will be stored in a directory that
>>> passed to command line option.
>>>
>>> Signed-off-by: Alexander Kuleshov 
>>> ---
>
> Looks like there were mostly editorial niggles and no fundamental
> flaws in the design of the patch; it is somewhat a shame to make all
> the efforts go to waste.  Will we be seeing an update soon?

Looking at the new test a bit more closely...

test_expect_success "format-patch format.outputDirectory option" '
git config format.outputDirectory "patches/" &&
git format-patch master..side &&
cnt=$(ls | wc -l) &&
test $cnt = 3 &&
test_config format.outputDirectory "patches/" &&
git config --unset format.outputDirectory
'

I'm wondering what it's really testing. I presume that it wanted to
count the number of files in the 'patches/' directory, however, the
'ls' is being invoked in the test trash directory instead. It turns
out that the trash directory has three entries at this point, so the
test succeeds, but entirely by accident.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2015-06-19 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-directory if an user has pattern
to store all patches in the /patches directory for example.

The format.outputDirectory has lower priority than command line
option, so if user will set format.outputDirectory and pass the
command line option, a result will be stored in a directory that
passed to command line option.

Signed-off-by: Alexander Kuleshov kuleshovm...@gmail.com
---
 Documentation/config.txt   |  4 
 Documentation/git-format-patch.txt |  6 +-
 builtin/log.c  |  8 
 t/t4014-format-patch.sh| 18 ++
 4 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index e159fe5..4f991b6 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1262,6 +1262,10 @@ format.coverLetter::
format-patch is invoked, but in addition can be set to auto, to
generate a cover-letter only when there's more than one patch.
 
+format.outputDirectory::
+   Set a custom directory to store the resulting files instead of the
+   current working directory.
+
 filter.driver.clean::
The command which is used to convert the content of a worktree
file to a blob upon checkin.  See linkgit:gitattributes[5] for
diff --git a/Documentation/git-format-patch.txt 
b/Documentation/git-format-patch.txt
index 0dac4e9..38ddd76 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -57,7 +57,11 @@ The names of the output files are printed to standard
 output, unless the `--stdout` option is specified.
 
 If `-o` is specified, output files are created in dir.  Otherwise
-they are created in the current working directory.
+they are created in the current working directory. The default path
+can be set with the seting 'format.outputDirectory' configuration option.
+If `-o` is specified and 'format.outputDirectory' is set, output files
+will be stored in a dir that passed to `-o`. When 'format.outputDirectory'
+is set to get default behaviour back is to pass './' to the `-o`.
 
 By default, the subject of a single patch is [PATCH]  followed by
 the concatenation of lines from the commit message up to the first blank
diff --git a/builtin/log.c b/builtin/log.c
index 78b3e2c..fc26360 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -688,6 +688,8 @@ enum {
COVER_AUTO
 };
 
+static const char *config_output_directory = NULL;
+
 static int git_format_config(const char *var, const char *value, void *cb)
 {
if (!strcmp(var, format.headers)) {
@@ -758,6 +760,9 @@ static int git_format_config(const char *var, const char 
*value, void *cb)
config_cover_letter = git_config_bool(var, value) ? COVER_ON : 
COVER_OFF;
return 0;
}
+   if (!strcmp(var, format.outputdirectory)) {
+   return git_config_string(config_output_directory, var, value);
+   }
 
return git_log_config(var, value, cb);
 }
@@ -1368,6 +1373,9 @@ int cmd_format_patch(int argc, const char **argv, const 
char *prefix)
if (rev.show_notes)
init_display_notes(rev.notes_opt);
 
+   if (!output_directory  !use_stdout)
+   output_directory = config_output_directory;
+
if (!use_stdout)
output_directory = set_outdir(prefix, output_directory);
else
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 890db11..613e2cc 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -40,6 +40,24 @@ test_expect_success setup '
 
 '
 
+test_expect_success format-patch format.outputDirectory option '
+   git config format.outputDirectory patches/ 
+   git format-patch master..side 
+   cnt=$(ls | wc -l) 
+   test $cnt = 3 
+   test_config format.outputDirectory patches/ 
+   git config --unset format.outputDirectory
+'
+
+test_expect_success format-patch format.outputDirectory overwritten with -o '
+   rm -rf patches 
+   git config format.outputDirectory patches/ 
+   git format-patch master..side -o . 
+   test_must_fail ls patches/ 
+   test_config format.outputDirectory patches/ 
+   git config --unset format.outputDirectory
+'
+
 test_expect_success format-patch --ignore-if-in-upstream '
 
git format-patch --stdout master..side patch0 
-- 
2.4.4.727.g5c3049e.dirty

--
To unsubscribe from this list: send the line unsubscribe git in