Thread (6 messages) flat view 6 messages, 3 authors, 2016-06-15

Re: [PATCH] Use parseopts in builtin-fetch

From: Daniel Barkalow <hidden>
Date: 2016-06-15 22:43:47

On Mon, 5 Nov 2007, Pierre Habouzit wrote:
On Mon, Nov 05, 2007 at 03:35:34AM +0000, Daniel Barkalow wrote:
quoted
I mostly did this and the next one for practice with the API. I'm 
impressed that "git fetch -vv" is even handled correctly without anything 
special.
  About that: OPTION_BOOLEAN increments the associated variable, to
support this case specifically.

  The last thing that really miss in parse-options is a way to recurse
into a sub-array of struct option, to be able to port the generic diff
and revision arguments.

  Though, there is a difficulty here that I've not yet found how to
circumvent tastefully: right now options take an absolute pointer to
_the_ variable that will be filled with values. I need to be able to
relocate such a structure for sub-arrays for quite obvious reasons, and
that is quite hard to achieve without hazardous APIs. I currently lean
in the direction of simply memdup-ing the array and do fix-ups on
*values pointers. Though how to do that in a graceful way is not obvious
to me yet :)
I'm not entirely clear as to why the "diff options" to an arbitrary 
command can't configure variables in the diff engine. The tricky thing 
would be supporting a single command that has two sets of the same 
options (if git log could show the same stuff in two different ways at the 
same time, for example).

But, in any case, it should be possible for an OPT_* macro to take a 
struct type and a member name, do the offsetof and store that, and the 
inclusion macro would take the absolute pointer to the struct.

Next time I get a chance, I'll see if I can come up with something 
suitable.

	-Daniel
*This .sig left intentionally blank*
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help