From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 5D7DA1F9FC for ; Wed, 24 Mar 2021 18:44:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237587AbhCXSnq (ORCPT ); Wed, 24 Mar 2021 14:43:46 -0400 Received: from cloud.peff.net ([104.130.231.41]:47744 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237632AbhCXSnn (ORCPT ); Wed, 24 Mar 2021 14:43:43 -0400 Received: (qmail 14205 invoked by uid 109); 24 Mar 2021 18:43:43 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Wed, 24 Mar 2021 18:43:43 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 20669 invoked by uid 111); 24 Mar 2021 18:43:43 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Wed, 24 Mar 2021 14:43:43 -0400 Authentication-Results: peff.net; auth=none Date: Wed, 24 Mar 2021 14:43:42 -0400 From: Jeff King To: Han Xin Cc: Christian Couder , Junio C Hamano , Git List , Han Xin Subject: Re: [PATCH] pack-objects: fix comment of reused_chunk.difference Message-ID: References: <20210323032050.97700-1-chiyutianyi@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210323032050.97700-1-chiyutianyi@gmail.com> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Tue, Mar 23, 2021 at 11:20:50AM +0800, Han Xin wrote: > From: Han Xin > > 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