git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Derrick Stolee <stolee@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] pack-objects: update "nr_seen" progress based on pack-reused count
Date: Tue, 13 Apr 2021 03:39:36 -0400	[thread overview]
Message-ID: <YHVKuFaR/AjYhf9b@coredump.intra.peff.net> (raw)
In-Reply-To: <06e42cf3-188c-d314-b3b9-bdb2f43a37e6@gmail.com>

On Mon, Apr 12, 2021 at 08:48:24PM -0400, Derrick Stolee wrote:

> On 4/11/2021 11:41 PM, Jeff King wrote:> diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
> > index 525c2d8552..faee5a5c76 100644
> > --- a/builtin/pack-objects.c
> > +++ b/builtin/pack-objects.c
> > @@ -3527,7 +3527,8 @@ static int get_object_list_from_bitmap(struct rev_info *revs)
> >  			&reuse_packfile_bitmap)) {
> >  		assert(reuse_packfile_objects);
> >  		nr_result += reuse_packfile_objects;
> > -		display_progress(progress_state, nr_result);
> > +		nr_seen += reuse_packfile_objects;
> > +		display_progress(progress_state, nr_seen);
> 
> nr_seen and nr_result are defined in the same line with nr_written,
> as static globals. I can understand how this mistake happened.

I think it is even more subtle than that. Both topics (the one to
convert callers to use nr_seen as progress, and the one adding this call
to use nr_result for progress) were "in flight" at the same time, but in
a funny way. The latter was written much earlier in a fork of Git, but
not sent upstream immediately. So the nr_seen conversion didn't know
about it, and later the other topic was "merged" (actually,
cherry-picked) into upstream.

So it really is a semantic conflict when merging two branches that
happened simultaneously. It's a little odd in that the branches were
running simultaneously for years, but the same thing could happen even
with two topics much closer together.

Anyway, that's all just an interesting sidenote.

> There are no other places where nr_result is used for
> display_progress() while nr_seen _is_ used a couple more times.

Thanks for double-checking. That make sense, since we added only this
one call, and the others were all converted to nr_seen when it was
introduced.

-Peff

      reply	other threads:[~2021-04-13  7:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-12  3:41 [PATCH] pack-objects: update "nr_seen" progress based on pack-reused count Jeff King
2021-04-13  0:48 ` Derrick Stolee
2021-04-13  7:39   ` Jeff King [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YHVKuFaR/AjYhf9b@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=stolee@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).