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

2 messages, 2 authors, 2018-01-03 · open the first message on its own page

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

From: Junio C Hamano <hidden>
Date: 2018-01-03 22:08:30

Stefan Beller [off-list ref] 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.
Once you have that mask, you should be able to use HAS_MULTI_BITS()
on the masked result without counting, no?

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

From: Stefan Beller <hidden>
Date: 2018-01-03 22:18:22

On Wed, Jan 3, 2018 at 2:08 PM, Junio C Hamano [off-list ref] wrote:
Stefan Beller [off-list ref] writes:

;
quoted
+     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)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help