git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pierre Habouzit <madcoder@debian.org>
To: Jakub Narebski <jnareb@gmail.com>
Cc: Jonathan Nieder <jrnieder@gmail.com>,
	Matthieu Moy <Matthieu.Moy@imag.fr>,
	git@vger.kernel.org, Jeff King <peff@peff.net>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [RFC PATCH 0/2] Allow detached forms (--option arg) for git log options.
Date: Wed, 28 Jul 2010 15:06:11 +0200	[thread overview]
Message-ID: <20100728130610.GG6895@madism.org> (raw)
In-Reply-To: <m37hkhklll.fsf@localhost.localdomain>

On Tue, Jul 27, 2010 at 08:10:35AM -0700, Jakub Narebski wrote:
> Pierre Habouzit <madcoder@debian.org> writes:
> 
> > On Mon, Jul 26, 2010 at 02:31:09PM -0500, Jonathan Nieder wrote:
> > > Hi Matthieu,
> > > 
> > > Matthieu Moy wrote:
> > > 
> > > >                    is there any reason why "git log" hasn't been
> > > > migrated to parse-option? Or is it only that nobody did it yet?
> > > 
> > > Please go ahead. :)
> > 
> > I started it in the past, but never went around to actually do it.
> > 
> > I started to get rid of most of the bitfields to use explicit or-ed
> > fields, but stopped at that, I don't even remember if those patches got
> > merged or not.
> 
> Why did you feel this change was needed / necessary?  Was it
> limitation of parseopt?  Or perhaps it was for portability reasons?
> Or was it just the matter of code elegance?

you cannot take the address of a bit portably in C, so you can't let
parseopt set/clear bits through bitfields (as in unsigned field : 1 in a
struct in C I mean).

So to use parseopt OPTION_BIT feature, you have to convert them to C
flags as in "unsigned flags" and explicit masks defines/enums.

IOW:

    struct foo {
       unsigned bar : 1,
		...
		baz : 1;
    };

Must be converted into:

    struct foo {
    #define FOO_FLAG_BAR (1U <<  1)
    ...
    #define FOO_FLAG_BAZ (1U << 18)
      unsigned flags;
    }

so that you can use parseopt.  that's what I meant.


This was done for the rev-list parsing stuff e.g.
-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

  reply	other threads:[~2010-07-28 13:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-26 18:14 [RFC PATCH 0/2] Allow detached forms (--option arg) for git log options Matthieu Moy
2010-07-26 18:14 ` [RFC PATCH 1/2] Allow "git log --grep foo" as synonym for "git log --grep=foo" Matthieu Moy
2010-07-27  6:43   ` Sverre Rabbelier
2010-07-27  8:40     ` Miles Bader
2010-07-27 10:24       ` Jakub Narebski
2010-07-27  8:45     ` Matthieu Moy
2010-07-27 10:18   ` Ævar Arnfjörð Bjarmason
2010-07-27 11:56     ` Matthieu Moy
2010-07-27 12:21       ` Ævar Arnfjörð Bjarmason
2010-07-27 13:26         ` Matthieu Moy
2010-07-27 13:46           ` Ævar Arnfjörð Bjarmason
2010-07-26 18:14 ` [RFC PATCH 2/2] Allow "git log -S string" as synonym for "git log -Sstring" Matthieu Moy
2010-07-27  6:42   ` Sverre Rabbelier
2010-07-26 19:31 ` [RFC PATCH 0/2] Allow detached forms (--option arg) for git log options Jonathan Nieder
2010-07-27 14:46   ` Pierre Habouzit
2010-07-27 15:10     ` Jakub Narebski
2010-07-28 13:06       ` Pierre Habouzit [this message]
2010-07-29  9:16         ` Jakub Narebski
2010-07-29 18:33           ` Pierre Habouzit
2010-08-01  5:24         ` Jonathan Nieder

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=20100728130610.GG6895@madism.org \
    --to=madcoder@debian.org \
    --cc=Matthieu.Moy@imag.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jnareb@gmail.com \
    --cc=jrnieder@gmail.com \
    --cc=peff@peff.net \
    /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).