git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Han Xin <chiyutianyi@gmail.com>
Cc: Christian Couder <christian.couder@gmail.com>,
	Junio C Hamano <gitster@pobox.com>,
	Git List <git@vger.kernel.org>,
	Han Xin <hanxin.hx@alibaba-inc.com>
Subject: Re: [PATCH] pack-objects: fix comment of reused_chunk.difference
Date: Wed, 24 Mar 2021 14:43:42 -0400	[thread overview]
Message-ID: <YFuIXvQSUzbJgDLp@coredump.intra.peff.net> (raw)
In-Reply-To: <20210323032050.97700-1-chiyutianyi@gmail.com>

On Tue, Mar 23, 2021 at 11:20:50AM +0800, Han Xin wrote:

> From: Han Xin <hanxin.hx@alibaba-inc.com>
> 
> As record_reused_object(offset, offset - hashfile_total(out)) said,
> reused_chunk.difference should be the offset of original packfile minus
> the offset of the generated packfile. But the comment presented an opposite way.
> [...]
>
> @@ -810,8 +810,8 @@ static struct reused_chunk {
>  	/* The offset of the first object of this chunk in the original
>  	 * packfile. */
>  	off_t original;
> -	/* The offset of the first object of this chunk in the generated
> -	 * packfile minus "original". */
> +	/* The difference for "original" minus the offset of the first object of
> +	 * this chunk in the generated packfile. */
>  	off_t difference;

The naming and comments here came from Christian's upstreaming of the
topic (cc'd). In the original, this was just called "offset". And there
was no comment, so it couldn't be wrong. ;)

I think your suggestion here is correct. The value comes from the
"offset" parameter of record_reused_object(), and we pass:

  record_reused_object(offset, offset - hashfile_total(out));

(where "offset" here is the pack position in the original packfile). So
it is definitely "original_offset - output_offset".

All of which is a long-winded way of saying "looks good to me". :)

-Peff

      reply	other threads:[~2021-03-24 18:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23  3:20 [PATCH] pack-objects: fix comment of reused_chunk.difference Han Xin
2021-03-24 18:43 ` 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=YFuIXvQSUzbJgDLp@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=chiyutianyi@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hanxin.hx@alibaba-inc.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).