From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Christian Couder <chriscool@tuxfamily.org>
Cc: Git List <git@vger.kernel.org>,
Jonathan Nieder <jrnieder@gmail.com>,
Junio C Hamano <gitster@pobox.com>,
Daniel Barkalow <barkalow@iabervon.org>
Subject: Re: [RFC PATCH] revert: Persist per-session opts
Date: Mon, 11 Jul 2011 11:42:44 +0530 [thread overview]
Message-ID: <CALkWK0ndSWkPudM_sJnyUyh93t9JLk-t-YFQb7=WO2H_svnGdQ@mail.gmail.com> (raw)
In-Reply-To: <201107101002.06385.chriscool@tuxfamily.org>
Hi Christian,
Christian Couder writes:
> On Saturday 09 July 2011 17:41:58 Ramkumar Ramachandra wrote:
>> Save the replay_opts struct in .git/sequencer/opts using a simple "key
>> = value" format. Parse it and populate the options structure before
>> replaying.
>
> [...]
>
>> static void format_todo(struct strbuf *buf, struct commit_list *todo_list,
>> struct replay_opts *opts)
>> {
>> @@ -733,6 +759,102 @@ error:
>> die(_("Malformed instruction sheet: %s"), git_path(SEQ_TODO_FILE));
>> }
>>
>> +static char *parse_opt_value(char *p, void *key, enum seq_opt_type type,
>> + parse_opt_cb *cb_function) {
>> + struct option opt;
>> + char *val, *cur, *end;
>> +
>> + if (!(val = strchr(p, '=')))
>> + goto error;
>> + if (!*(val + 1))
>> + goto error;
>> + if (!(end = strchr(p, '\n')))
>> + goto error;
>> + val += 2;
>
> It looks like you rely on all lines ending with \n and having a space after
> the '='. It may be a little bit too fragile.
Right. Thanks for the review -- will try to reuse bits of the
git-config parser.
-- Ram
next prev parent reply other threads:[~2011-07-11 6:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-09 15:41 [RFC PATCH] An option parser for the sequencer Ramkumar Ramachandra
2011-07-09 15:41 ` [RFC PATCH] revert: Persist per-session opts Ramkumar Ramachandra
2011-07-10 8:02 ` Christian Couder
2011-07-11 6:12 ` Ramkumar Ramachandra [this message]
2011-07-10 8:15 ` [RFC PATCH] An option parser for the sequencer Christian Couder
2011-07-11 6:11 ` Ramkumar Ramachandra
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CALkWK0ndSWkPudM_sJnyUyh93t9JLk-t-YFQb7=WO2H_svnGdQ@mail.gmail.com' \
--to=artagnon@gmail.com \
--cc=barkalow@iabervon.org \
--cc=chriscool@tuxfamily.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).