Re: [PATCH] Make builtin-tag.c use parse_options.
- From
Kristian Høgsberg <krh@redhat.com>
- Date
- Nov 12, 2007, 19:48 UTC
- Message-ID
- <1194896926.2869.15.camel@hinata.boston.redhat.com>
- In-Reply-To
- <1b46aba20711120509l104792ebo4ea9a51c710510f3@mail.gmail.com>
On Mon, 2007-11-12 at 14:09 +0100, Carlos Rica wrote:
> 2007/11/10, Junio C Hamano <gitster@pobox.com>: > > Carlos Rica <jasampler@gmail.com> writes:
...
Show 6 quoted lines
> Then, Kristian, what are you willing to do in such case? > It seems easier for me to concatenate of -m and -F options, even when > both types are given. I don't know why "people" want multiple -m options, > but I think that mixing -m and -F options could be interesting for them too. > If someone know if this have been discussed and decided already, > please give me the link.
I should be pretty easy to just append the contents of multiple fies, even inter-mingled with -m options. We just do a callback like Johannes just did for -m in builtin-commit.c for -F and append to the same strbuf. strbuf_read() already appends, so the callback could look something like:
static int opt_parse_F(const struct option *opt, const char *arg, int
unset)
{
struct strbuf *buf = opt->value; if (!strcmp(arg, "-")) {
if (isatty(0))
fprintf(stderr, "(reading log message from
standard input)\n");
if (strbuf_read(&sb, 0, 0) < 0)
die("could not read log from standard input");
} else {
if (strbuf_read_file(&sb, logfile, 0) < 0)
die("could not read log file '%s': %s",
logfile, strerror(errno));
}
}Shouldn't be too hard :) Kristian