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

4 messages, 2 authors, 2016-06-15 · open the first message on its own page

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:05:24

Alexander Kuleshov [off-list ref] writes:
2015-06-19 3:46 GMT+06:00 Junio C Hamano [off-list ref]:
quoted
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
patch?
@@ -1337,6 +1342,9 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
                die (_("--subject-prefix and -k are mutually exclusive."));
        rev.preserve_subject = keep_subject;

+       if (!output_directory && !use_stdout)
+               output_directory = config_output_directory;
+
But there is following condition above:

 if (!use_stdout)
      output_directory = set_outdir(prefix, output_directory);

After which output_directory will be "./" everytime and
quoted
+       if (!output_directory && !use_stdout)
+               output_directory = config_output_directory;
+
will not work here.
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.

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

From: Alexander Kuleshov <hidden>
Date: 2016-06-15 23:05:24

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:

if (!use_stdout)
        output_directory = set_outdir(prefix, output_directory);
else
        setup_pager();

and

if (output_directory) {
    // test that we did not pass use_stdout and mkdir than
}

If we didn't pass --stdout and -o the set_outdir will be called
and there is

static const char *set_outdir(const char *prefix, const char *output_directory)
{
    //printf("is_absoulte_path %d\n", is_absolute_path(output_directory));
    if (output_directory && is_absolute_path(output_directory))
        return output_directory;

    if (!prefix || !*prefix) {
        if (output_directory)
            return output_directory;
        return "./";
    }
....
}

So it returns "./", output_directory will not be null. After this
quoted
+       if (!output_directory && !use_stdout)
+               output_directory = config_output_directory;
clause will not be executed never. Or I've missed something?

Thank you.

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

From: Alexander Kuleshov <hidden>
Date: 2016-06-15 23:05:24

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 [off-list ref]:
quoted
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:

if (!use_stdout)
        output_directory = set_outdir(prefix, output_directory);
else
        setup_pager();

and

if (output_directory) {
    // test that we did not pass use_stdout and mkdir than
}

If we didn't pass --stdout and -o the set_outdir will be called
and there is

static const char *set_outdir(const char *prefix, const char *output_directory)
{
    //printf("is_absoulte_path %d\n", is_absolute_path(output_directory));
    if (output_directory && is_absolute_path(output_directory))
        return output_directory;

    if (!prefix || !*prefix) {
        if (output_directory)
            return output_directory;
        return "./";
    }
....
}

So it returns "./", output_directory will not be null. After this
quoted
quoted
+       if (!output_directory && !use_stdout)
+               output_directory = config_output_directory;
clause will not be executed never. Or I've missed something?

Thank you.

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

From: Alexander Kuleshov <hidden>
Date: 2016-06-15 23:05:24

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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help