git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Kristian Høgsberg" <krh@redhat.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: [RFC] Update on builtin-commit
Date: Mon, 02 Jul 2007 12:51:22 -0400	[thread overview]
Message-ID: <1183395082.30611.16.camel@hinata.boston.redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0707021709120.4071@racer.site>

On Mon, 2007-07-02 at 17:11 +0100, Johannes Schindelin wrote:
> just a quick comment on the option parser:
> 
> On most platforms, sizeof(void*)>=sizeof(int). But I would not rely on 
> that. Rather (also because it is prettier), I'd use "union".

In the OPTION_INTEGER case, the 'value' void pointer points to an
integer global that's set to the value passed.  In the OPTION_NONE, it
also points to an integer, which is set to 1 if the option is seen.  So
I'm relying on sizeof(void*) == sizeof(int*), but I'm not storing ints
in pointers.

> Besides, your option parser loses order information, correct? IOW, 
> something like "--color --no-color --color" would confuse it.

Yes, I don't record the order of options, but in the builtin-commit
case, I don't think there are any options where that makes a difference?
In cases where order is important or we have an option that negates the
effect of another option (your --no-color example), we could either 1)
extend the option struct with a 'disable' name that flips the value back
to 0 or 2) instead of just setting it to 1, record the index of the
options passed and compare the indexes of conflicting options to see
which one was passed last.

Kristian

  reply	other threads:[~2007-07-02 16:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-02 14:22 [RFC] Update on builtin-commit Kristian Høgsberg
2007-07-02 16:11 ` Johannes Schindelin
2007-07-02 16:51   ` Kristian Høgsberg [this message]
2007-07-02 17:02     ` Johannes Schindelin
2007-07-02 17:34       ` Jeffrey C. Ollie
2007-07-02 17:57         ` Kristian Høgsberg

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1183395082.30611.16.camel@hinata.boston.redhat.com \
    --to=krh@redhat.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    /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.
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 NNTP newsgroup(s).