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

Re: [PATCH 5/5] diff: properly error out when combining multiple pickaxe options

From
Stefan Beller <sbeller@google.com>
Date
Jan 3, 2018, 22:18 UTC
Message-ID
<CAGZ79kaef93BVM+Xaihad7cij-tc6DvWAgwo+Ps1zt_3Jn84Tg@mail.gmail.com>
In-Reply-To
<xmqq7esyh9ym.fsf@gitster.mtv.corp.google.com>
On Wed, Jan 3, 2018 at 2:08 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 16 quoted lines
> Stefan Beller <sbeller@google.com> writes:
>
> ;
>> +     count = 0;
>> +
>> +     if (options->pickaxe_opts & DIFF_PICKAXE_KIND_S)
>> +             count++;
>> +     if (options->pickaxe_opts & DIFF_PICKAXE_KIND_G)
>> +             count++;
>> +     if (options->pickaxe_opts & DIFF_PICKAXE_KIND_OBJFIND)
>> +             count++;
>> +     if (count > 1)
>> +             die(_("-G, -S, --find-object are mutually exclusive"));
>
> I thought the reason you defined pickaxe-kind bitmask was so that
> you can mask this field to grab these (and only these) bits.

Originally I only wanted to mask out the 'case independency' bit and keep it future proof for any similar bits.

> Once you have that mask, you should be able to use HAS_MULTI_BITS()
> on the masked result without counting, no?
Oh, what a nice macro! Thanks for pointing at it.

As soon as I figured out the right place where to put this check, I saw the lines above, whose style I imitated. (I guess there is just no mask defined for "--name-only, --name-status, --check and -s", nor would it make sense to do so; though that given macro should work just fine even for non-continuous masks)

Previous: Junio C HamanoNext: Stefan Beller
Message 10 of 19 in “pickaxe refactorings and a new mode to find blobs (WAS: diffcore: add a pickaxe option to find a specific blob)”
  1. 0/5 pickaxe refactorings and a new mode to find blobs (WAS: diffcore: add a pickaxe option to find a specific blob)Stefan Beller, Jan 3, 2018
  2. 1/5 diff.h: Make pickaxe_opts an unsigned bit fieldStefan Beller, Jan 3, 2018
  3. Junio C HamanoJan 3, 2018
  4. 2/5 diff: migrate diff_flags.pickaxe_ignore_case to a pickaxe_opts bitStefan Beller, Jan 3, 2018
  5. 4/5 diffcore: add a pickaxe option to find a specific blobStefan Beller, Jan 3, 2018
  6. 4/5 diffcore: add a pickaxe option to find a specific blobStefan Beller, Jan 3, 2018
  7. 5/5 diff: properly error out when combining multiple pickaxe optionsStefan Beller, Jan 3, 2018
  8. Jacob KellerJan 3, 2018
  9. Junio C HamanoJan 3, 2018
  10. Stefan BellerJan 3, 2018
  11. 3/5 diff: introduce DIFF_PICKAXE_KINDS_MASKStefan Beller, Jan 3, 2018
  12. Junio C HamanoJan 3, 2018
  13. 0/6 pickaxe refactorings and a new mode to find blobs (WAS: diffcore: add a pickaxe option to find a specific blob)Stefan Beller, Jan 4, 2018
  14. 1/6 diff.h: Make pickaxe_opts an unsigned bit fieldStefan Beller, Jan 4, 2018
  15. 3/6 diff: introduce DIFF_PICKAXE_KINDS_MASKStefan Beller, Jan 4, 2018
  16. 4/6 diffcore: add a pickaxe option to find a specific blobStefan Beller, Jan 4, 2018
  17. 5/6 diff: properly error out when combining multiple pickaxe optionsStefan Beller, Jan 4, 2018
  18. 2/6 diff: migrate diff_flags.pickaxe_ignore_case to a pickaxe_opts bitStefan Beller, Jan 4, 2018
  19. 6/6 diff: use HAS_MULTI_BITS instead of counting bits manuallyStefan Beller, Jan 4, 2018

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.