git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH] revert: Persist per-session opts

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Jul 11, 2011, 06:12 UTC
Message-ID
<CALkWK0ndSWkPudM_sJnyUyh93t9JLk-t-YFQb7=WO2H_svnGdQ@mail.gmail.com>
In-Reply-To
<201107101002.06385.chriscool@tuxfamily.org>
Hi Christian,
Christian Couder writes:
Show 29 quoted lines
> 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
Previous: Christian CouderNext: Christian Couder
Message 4 of 6 in “An option parser for the sequencer”
  1. An option parser for the sequencerRamkumar Ramachandra, Jul 9, 2011
  2. revert: Persist per-session optsRamkumar Ramachandra, Jul 9, 2011
  3. Christian CouderJul 10, 2011
  4. Ramkumar RamachandraJul 11, 2011
  5. Christian CouderJul 10, 2011
  6. Ramkumar RamachandraJul 11, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.