All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Tan <jonathantanmy@google.com>
To: gitster@pobox.com
Cc: jonathantanmy@google.com, wambui.karugax@gmail.com, git@vger.kernel.org
Subject: Re: [Outreachy] [PATCH] blame: Convert pickaxe_blame defined constants to enums
Date: Fri, 11 Oct 2019 11:44:41 -0700	[thread overview]
Message-ID: <20191011184441.103527-1-jonathantanmy@google.com> (raw)
In-Reply-To: <xmqqsgnzj4vs.fsf@gitster-ct.c.googlers.com>

> Jonathan Tan <jonathantanmy@google.com> writes:
> 
> >> -	if ((opt & PICKAXE_BLAME_COPY_HARDEST)
> >> -	    || ((opt & PICKAXE_BLAME_COPY_HARDER)
> >> +	if ((opt & BLAME_COPY_HARDEST)
> >> +	    || ((opt & BLAME_COPY_HARDER)
> >
> > Any reason why the names are renamed to omit "PICKAXE_"? In particular,
> > these names are still global, so it is good to retain the extra context.
> 
> Absolutely.  Removing them is wrong, I would have to say.

Thanks for clarifying.

> >>  #define BLAME_DEFAULT_MOVE_SCORE	20
> >>  #define BLAME_DEFAULT_COPY_SCORE	40
> >>  
> >> +enum pickaxe_blame_action {
> >> +	BLAME_MOVE = 01,
> >> +	BLAME_COPY,
> >> +	BLAME_COPY_HARDER = 04,
> >> +	BLAME_COPY_HARDEST = 010,
> >> +};
> 
> We had a bit of discussion recently about using (or rather, not
> abusing) enum for set of bits on a different topic.

For reference, the discussion is here [1]. Szeder Gábor has a dissenting
argument in [2] that makes sense to me (gdb on my desktop also shows an
enum used as a bitset as "(A | B)"). But in any case, perhaps we should
decide if it's fine to use an enum here before Wambui Karuga continues
development.

[1] https://public-inbox.org/git/xmqqsgobg0rv.fsf@gitster-ct.c.googlers.com/
[2] https://public-inbox.org/git/20191007171249.GB11529@szeder.dev/

> > Also, I have a slight preference for putting "= 02" on the BLAME_COPY
> > line but that is not necessary.
> 
> That is absolutely necessary; it is not like "we do not care what
> exact value _COPY gets; it can be any value as long as it is _MOVE
> plus 1", as these are used in set of bits (and again, I do not think
> it is such a brilliant idea to use enum for such a purpose).

Good point.

  reply	other threads:[~2019-10-11 18:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10 11:52 [Outreachy] [PATCH] blame: Convert pickaxe_blame defined constants to enums Wambui Karuga
2019-10-10 18:44 ` Jonathan Tan
2019-10-11  4:13   ` Junio C Hamano
2019-10-11 18:44     ` Jonathan Tan [this message]
2019-10-12  0:30       ` Junio C Hamano
2019-10-14 18:27         ` Jonathan Tan
2019-10-14 19:37           ` Wambui Karuga
2019-10-14 21:46             ` Jonathan Tan
2019-10-15 12:06               ` Wambui Karuga
2019-10-15  8:45           ` SZEDER Gábor
2019-10-11  8:52   ` Wambui Karuga
2019-10-11 18:48     ` Jonathan Tan
2019-10-11 20:04       ` Wambui Karuga

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=20191011184441.103527-1-jonathantanmy@google.com \
    --to=jonathantanmy@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=wambui.karugax@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.