From: Sverre Rabbelier <srabbelier@gmail.com>
To: "Junio C Hamano" <gitster@pobox.com>,
"Shawn O. Pearce" <spearce@spearce.org>,
"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
"Git List" <git@vger.kernel.org>
Cc: Sverre Rabbelier <srabbelier@gmail.com>
Subject: [PATCH 3/4] fast-import: add option command
Date: Wed, 12 Aug 2009 22:09:45 -0700 [thread overview]
Message-ID: <1250140186-12363-4-git-send-email-srabbelier@gmail.com> (raw)
In-Reply-To: <1250140186-12363-3-git-send-email-srabbelier@gmail.com>
This allows the frontend to specify any of the supported options as
long as no non-option command has been given. This way the
user does not have to include any frontend-specific options, but
instead she can rely on the frontend to tell fast-import what it
needs.
---
This is a lot simpler from the previous version as we can now
reuse parse_one_option from 1/4.
fast-import.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/fast-import.c b/fast-import.c
index 17d57ab..2ec804d 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -348,6 +348,7 @@ static struct recent_command *rc_free;
static unsigned int cmd_save = 100;
static uintmax_t next_mark;
static struct strbuf new_data = STRBUF_INIT;
+static int seen_non_option_command;
static void write_branch_report(FILE *rpt, struct branch *b)
{
@@ -1663,6 +1664,10 @@ static int read_next_command(void)
if (stdin_eof)
return EOF;
+ if (!seen_non_option_command
+ && prefixcmp(command_buf.buf, "option "))
+ seen_non_option_command = 1;
+
rc = rc_free;
if (rc)
rc_free = rc->next;
@@ -2460,6 +2465,16 @@ static void parse_one_option(const char *option)
}
}
+static void parse_option(void)
+{
+ char* option = command_buf.buf + 7;
+
+ if (seen_non_option_command)
+ die("Got option command '%s' after non-option command", option);
+
+ parse_one_option(option);
+}
+
static int git_pack_config(const char *k, const char *v, void *cb)
{
if (!strcmp(k, "pack.depth")) {
@@ -2534,6 +2549,8 @@ int main(int argc, const char **argv)
parse_checkpoint();
else if (!prefixcmp(command_buf.buf, "progress "))
parse_progress();
+ else if (!prefixcmp(command_buf.buf, "option "))
+ parse_option();
else
die("Unsupported command: %s", command_buf.buf);
}
--
1.6.4.16.g72c66.dirty
next prev parent reply other threads:[~2009-08-13 5:10 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-13 5:09 [PATCH 0/4] fast-import: add a new option command Sverre Rabbelier
2009-08-13 5:09 ` [PATCH 1/4] fast-import: put option parsing code in seperate functions Sverre Rabbelier
2009-08-13 5:09 ` [PATCH 2/4] fast-import: define a new option command Sverre Rabbelier
2009-08-13 5:09 ` Sverre Rabbelier [this message]
2009-08-13 5:09 ` [PATCH 4/4] fast-import: test the " Sverre Rabbelier
2009-08-13 14:45 ` [PATCH 3/4] fast-import: add " Shawn O. Pearce
2009-08-13 14:43 ` [PATCH 2/4] fast-import: define a new " Shawn O. Pearce
2009-08-13 14:56 ` Johannes Schindelin
2009-08-13 15:04 ` Shawn O. Pearce
[not found] ` <fabb9a1e0908130812s297ccfc6vd6b746daf1dcc69a@mail.gmail.com>
2009-08-13 15:24 ` Shawn O. Pearce
2009-08-13 16:26 ` Sverre Rabbelier
2009-08-13 17:07 ` Johannes Schindelin
2009-08-13 17:09 ` Sverre Rabbelier
2009-08-13 17:25 ` Shawn O. Pearce
2009-08-13 17:28 ` Sverre Rabbelier
2009-08-13 17:41 ` Shawn O. Pearce
2009-08-13 17:44 ` Sverre Rabbelier
2009-08-13 17:52 ` Shawn O. Pearce
2009-08-13 21:51 ` Johannes Schindelin
2009-08-13 22:01 ` Sverre Rabbelier
2009-08-13 22:12 ` Shawn O. Pearce
2009-08-13 22:17 ` Sverre Rabbelier
2009-08-13 19:26 ` Junio C Hamano
2009-08-13 20:01 ` Sverre Rabbelier
2009-08-13 20:42 ` Junio C Hamano
2009-08-13 21:14 ` Sverre Rabbelier
2009-11-23 17:39 ` Sverre Rabbelier
2009-11-23 20:50 ` Shawn O. Pearce
2009-08-13 10:19 ` [PATCH 1/4] fast-import: put option parsing code in seperate functions Johannes Schindelin
2009-08-13 14:40 ` Shawn O. Pearce
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=1250140186-12363-4-git-send-email-srabbelier@gmail.com \
--to=srabbelier@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=spearce@spearce.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox