git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Vijay Lakshminarayanan <laksvij@gmail.com>
Cc: Stephen Bash <bash@genarts.com>,
	git discussion list <git@vger.kernel.org>
Subject: Re: Git blame only current branch
Date: Mon, 12 Dec 2011 21:14:42 -0500	[thread overview]
Message-ID: <20111213021442.GA4244@sigill.intra.peff.net> (raw)
In-Reply-To: <8739cpteat.fsf@gmail.com>

On Tue, Dec 13, 2011 at 07:37:22AM +0530, Vijay Lakshminarayanan wrote:

> > diff --git a/builtin/blame.c b/builtin/blame.c
> > index 80febbe..c19a8cd 100644
> > --- a/builtin/blame.c
> > +++ b/builtin/blame.c
> > @@ -1191,6 +1191,8 @@ static int num_scapegoats(struct rev_info *revs, struct commit *commit)
> >  {
> >  	int cnt;
> >  	struct commit_list *l = first_scapegoat(revs, commit);
> > +	if (revs->first_parent_only)
> > +		return l ? 1 : 0;
> >  	for (cnt = 0; l; l = l->next)
> >  		cnt++;
> >  	return cnt;
> 
> I just spent 30s staring at this wondering why you needed to do 
> 
>     return 1 ? 1 : 0;
> 
> which always returns 1 anyway before I realized it was a lowercase L.
> 
> The code reads fine when there's no numeral 1 around but now it doesn't
> read well.  I think refactoring
> 
>     struct commit_list *l
> 
> to 
> 
>     struct commit_list *lst
> 
> is justified.  Thoughts?

Sure, that would help. I wasn't planning to push this forward as a
"real" patch, but if somebody wants to do some testing and, more
importantly read through the code to make sure I am not violating some
assumptions, then it might be worth including upstream.

-Peff

  reply	other threads:[~2011-12-13  2:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <e9e35956-a091-4143-8fd4-3516b54263a6@mail>
2011-12-12 15:24 ` Git blame only current branch Stephen Bash
2011-12-12 16:55   ` Jeff King
2011-12-12 17:05     ` Stephen Bash
2011-12-12 17:19       ` andreas.t.auer_gtml_37453
2011-12-13  2:07     ` Vijay Lakshminarayanan
2011-12-13  2:14       ` Jeff King [this message]
2011-12-13  5:47       ` Junio C Hamano
2011-12-13 14:09         ` Vijay Lakshminarayanan
2011-12-13 14:18           ` Frans Klaver
2011-12-13 17:25           ` Junio C Hamano

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=20111213021442.GA4244@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=bash@genarts.com \
    --cc=git@vger.kernel.org \
    --cc=laksvij@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 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).