Re: [RFC] Add a suffix option to git-format-patch
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jan 17, 2007, 13:49 UTC
- Message-ID
- <Pine.LNX.4.63.0701171446410.22628@wbgn013.biozentrum.uni-wuerzburg.de>
- In-Reply-To
- <625fc13d0701170510x8883539g93f43d9ddffe56f0@mail.gmail.com>
Hi,
On Wed, 17 Jan 2007, Josh Boyer wrote:
Show 13 quoted lines
> Could we add an option to git-format-patch to use ".patch" as the file > suffix instead of ".txt"? Something like the below? > > diff --git a/builtin-log.c b/builtin-log.c > index a59b4ac..4eb2d32 100644 > --- a/builtin-log.c > +++ b/builtin-log.c > @@ -217,6 +217,7 @@ static int git_format_config(const char *var, > const char *value) > > static FILE *realstdout = NULL; > static const char *output_directory = NULL; > +static int psuffix = 0;
Why not
static const char *file_extension = ".txt"
Hmm?
> } > - strcpy(filename + len, ".txt");
Here, you would write
strcpy(filename + len, file_extension);
Show 7 quoted lines
> @@ -436,6 +441,8 @@ int cmd_format_patch(int argc, const char **argv,
> const char *prefix)
> die("Need a Message-Id for --in-reply-to");
> in_reply_to = argv[i];
> }
> + else if (!strcmp(argv[i], "--psuffix"))
> + psuffix = 1;and here:
else if (!strncmp(argv[i], "--extension=", 12)) file_extension = argv[i] + 12;
You'd call it with "--extension=.patch", and if you really want, you can make a config variable from it.
Ciao, Dscho