Re: [PATCH/RFC] parse-options: add facility to make options configurable

2017-03-27 Thread Jeff King
On Sat, Mar 25, 2017 at 11:32:02PM +0100, Ævar Arnfjörð Bjarmason wrote: > > So hopefully it's clear that the two are functionally equivalent, and > > differ only in syntax (in this case we manually decided which options > > are safe to pull from the config, but we'd have to parse the options.log

Re: [PATCH/RFC] parse-options: add facility to make options configurable

2017-03-25 Thread Ævar Arnfjörð Bjarmason
On Sat, Mar 25, 2017 at 10:31 PM, Jeff King wrote: > On Sat, Mar 25, 2017 at 05:47:49PM +0100, Ævar Arnfjörð Bjarmason wrote: > >> After looking at some of the internal APIs I'm thinking of replacing >> this pattern with a hashmap.c hashmap where the keys are a >> sprintf("%d:%s", short_name, long

Re: [PATCH/RFC] parse-options: add facility to make options configurable

2017-03-25 Thread Jeff King
On Sat, Mar 25, 2017 at 05:47:49PM +0100, Ævar Arnfjörð Bjarmason wrote: > After looking at some of the internal APIs I'm thinking of replacing > this pattern with a hashmap.c hashmap where the keys are a > sprintf("%d:%s", short_name, long_name) to uniquely identify the > option. There's no other

Re: [PATCH/RFC] parse-options: add facility to make options configurable

2017-03-25 Thread brian m. carlson
On Fri, Mar 24, 2017 at 11:10:13PM +, Ævar Arnfjörð Bjarmason wrote: > On Sun, Mar 19, 2017 at 2:43 PM, Ævar Arnfjörð Bjarmason > wrote: > > I don't know if this is what Duy has in mind, but the facility I've > > described is purely an internal code reorganization issue. I.e. us > > not havi

Re: [PATCH/RFC] parse-options: add facility to make options configurable

2017-03-25 Thread Ævar Arnfjörð Bjarmason
On Sat, Mar 25, 2017 at 12:10 AM, Ævar Arnfjörð Bjarmason wrote: > [...] > This is all very proof-of-concept, and uses the ugly hack of s/const > // for the options struct because I'm now keeping state in it, as > noted in one of the TODO comments that should be moved. > [...] > static int parse

[PATCH/RFC] parse-options: add facility to make options configurable

2017-03-24 Thread Ævar Arnfjörð Bjarmason
Add a nascent WIP facility to specify via the options parsing that we'd e.g. like to grab the --status option for commit.status from the commit.status config key. This is all very proof-of-concept, and uses the ugly hack of s/const // for the options struct because I'm now keeping state in it, as