All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: "Stephen P. Smith" <ischis2@cox.net>
Cc: Git Mailing List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>,
	Alexander Kuleshov <kuleshovmail@gmail.com>
Subject: Re: [PATCH v6] format-patch: introduce format.outputDirectory configuration
Date: Wed, 13 Jan 2016 13:27:19 -0500	[thread overview]
Message-ID: <CAPig+cSxVdZN_wr3XuqDGuKn14J3B7s=S8OoH19v+AjMvcX6+Q@mail.gmail.com> (raw)
In-Reply-To: <1452691211-15347-1-git-send-email-ischis2@cox.net>

On Wed, Jan 13, 2016 at 8:20 AM, Stephen P. Smith <ischis2@cox.net> wrote:
> From: Alexander Kuleshov <kuleshovmail@gmail.com>
>
> We can pass -o/--output-directory to the format-patch command to store
> patches in some place other than the working directory. This patch
> introduces format.outputDirectory configuration option for same
> purpose.
>
> The case of usage of this configuration option can be convenience
> to not pass every time -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 <kuleshovmail@gmail.com>
> Signed-off-by: Stephen P. Smith <ischis2@cox.net>
> ---
> Notes:
>     Fixed s/convinience/convenience/
>
>     Moved 'static const char *config_output_directory;' to be with othe
>     similarly typed variables.

Thanks. This version is also:

Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>

(A note for future submissions of other patches: Once a person has
given a Reviewed-by:, you're welcome to include the Reviewed-by: in a
re-roll provided that the re-roll doesn't change anything which would
obviously invalidate the Reviewed-by:. In this particular case, for
instance, v6 merely fixed a couple very minor nits mentioned in my v5
review, so it would have been perfectly acceptable to include my
Reviewed-by: in v6.)

>  Documentation/config.txt           |  4 ++++
>  Documentation/git-format-patch.txt |  6 +++++-
>  builtin/log.c                      |  6 ++++++
>  t/t4014-format-patch.sh            | 15 +++++++++++++++
>  4 files changed, 30 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index f617886..e92a0ee 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -1243,6 +1243,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 e3cdaeb..64c2803 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 'format.outputDirectory' configuration option.
> +The `-o` option takes precedence over `format.outputDirectory`.
> +To store patches in the current working directory even when
> +`format.outputDirectory` points elsewhere, use `-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 e00cea7..0d738d6 100644
> --- a/builtin/log.c
> +++ b/builtin/log.c
> @@ -699,6 +699,7 @@ static int do_signoff;
>  static const char *signature = git_version_string;
>  static const char *signature_file;
>  static int config_cover_letter;
> +static const char *config_output_directory;
>
>  enum {
>         COVER_UNSET,
> @@ -777,6 +778,8 @@ 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);
>  }
> @@ -1391,6 +1394,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 646c475..3b99434 100755
> --- a/t/t4014-format-patch.sh
> +++ b/t/t4014-format-patch.sh
> @@ -1445,4 +1445,19 @@ test_expect_success 'From line has expected format' '
>         test_cmp from filtered
>  '
>
> +test_expect_success 'format-patch format.outputDirectory option' '
> +       test_config format.outputDirectory patches &&
> +       rm -fr patches &&
> +       git format-patch master..side &&
> +       test $(git rev-list master..side | wc -l) -eq $(ls patches | wc -l)
> +'
> +
> +test_expect_success 'format-patch -o overrides format.outputDirectory' '
> +       test_config format.outputDirectory patches &&
> +       rm -fr patches patchset &&
> +       git format-patch master..side -o patchset &&
> +       test_path_is_missing patches &&
> +       test_path_is_dir patchset
> +'
> +
>  test_done
> --
> 2.7.0-rc2

      reply	other threads:[~2016-01-13 18:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-19 18:28 [PATCH v2] format-patch: introduce format.outputDirectory configuration Alexander Kuleshov
2015-06-19 20:34 ` Eric Sunshine
2015-09-21 22:41   ` Junio C Hamano
2015-09-22  0:05     ` Eric Sunshine
2015-10-28 17:59     ` Junio C Hamano
2016-01-10  2:30   ` [PATCH v3] " Stephen P. Smith
2016-01-10  3:47     ` Eric Sunshine
2016-01-11  0:30       ` [PATCH v4] " Stephen P. Smith
2016-01-11  3:55         ` Eric Sunshine
2016-01-11  4:00           ` Eric Sunshine
2016-01-13  4:48             ` [PATCH v5] " Stephen P. Smith
2016-01-13  6:52               ` Eric Sunshine
2016-01-13 13:20                 ` [PATCH v6] " Stephen P. Smith
2016-01-13 18:27                   ` Eric Sunshine [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPig+cSxVdZN_wr3XuqDGuKn14J3B7s=S8OoH19v+AjMvcX6+Q@mail.gmail.com' \
    --to=sunshine@sunshineco.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=ischis2@cox.net \
    --cc=kuleshovmail@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.