git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH 0/2] Allow detached forms (--option arg) for git log options.

From
Pierre Habouzit <madcoder@debian.org>
Date
Jul 28, 2010, 13:06 UTC
Message-ID
<20100728130610.GG6895@madism.org>
In-Reply-To
<m37hkhklll.fsf@localhost.localdomain>
On Tue, Jul 27, 2010 at 08:10:35AM -0700, Jakub Narebski wrote:
Show 21 quoted lines
> 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
Previous: Jakub NarebskiNext: Jakub Narebski
Message 17 of 20 in “Allow detached forms (--option arg) for git log options.”
  1. 0/2 Allow detached forms (--option arg) for git log options.Matthieu Moy, Jul 26, 2010
  2. 1/2 Allow "git log --grep foo" as synonym for "git log --grep=foo".Matthieu Moy, Jul 26, 2010
  3. Sverre RabbelierJul 27, 2010
  4. Miles BaderJul 27, 2010
  5. Jakub NarebskiJul 27, 2010
  6. Matthieu MoyJul 27, 2010
  7. Ævar Arnfjörð BjarmasonJul 27, 2010
  8. Matthieu MoyJul 27, 2010
  9. Ævar Arnfjörð BjarmasonJul 27, 2010
  10. Matthieu MoyJul 27, 2010
  11. Ævar Arnfjörð BjarmasonJul 27, 2010
  12. 2/2 Allow "git log -S string" as synonym for "git log -Sstring".Matthieu Moy, Jul 26, 2010
  13. Sverre RabbelierJul 27, 2010
  14. Jonathan NiederJul 26, 2010
  15. Pierre HabouzitJul 27, 2010
  16. Jakub NarebskiJul 27, 2010
  17. Pierre HabouzitJul 28, 2010
  18. Jakub NarebskiJul 29, 2010
  19. Pierre HabouzitJul 29, 2010
  20. Jonathan NiederAug 1, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.