Re: [RFC] Re: Convert 'git blame' to parse_options()
On Mon, Jun 23, 2008 at 10:11:11PM +0000, Junio C Hamano wrote:
Show 22 quoted lines
> Linus Torvalds <torvalds@linux-foundation.org> writes:
>
> > On Mon, 23 Jun 2008, Pierre Habouzit wrote:
> >>
> >> Let's see if I can catch it elegantly.
> >
> > No.
> >
> > Look at builtin-blame.c.
> >
> > THEN get back to me.
> >
> > Trust me, you need what I wrote. Something that parses all the options in
> > one go, and ignores the ones it cannot parse, because a TOTALLY DIFFERENT
> > function than the caller will call it!
>
> I do not think you two are saying vastly different things.
>
> The series Pierre has just posted is prerequisite for teaching
> parse_options() to queue the unknown ones (besides allowing a finer
> grained stepwise parsing), so that the caller like cmd_blame() can call
> revision parser with the remainder.
Yeah actually one can use it this way, what I wrote can be used to do
the very same thing as your _KEEP_UNKNOWN flag, but also more.
Though I didn't fixed the fact that parse_options clobbers argv[0],
which can be easily fixed. The issue with that is that _some_ callers
use the fact that the filtered argv is NULL terminated. I'm unsure if
posix says that argv[argc] is readable and NULL at all, if it isn't,
then changing that would break git for some commands on some OSes other
than Linux and BSD where AFAICT argv[argc] == NULL holds.
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org