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-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id CC8671F885 for ; Fri, 10 Jan 2020 08:26:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726902AbgAJI02 (ORCPT ); Fri, 10 Jan 2020 03:26:28 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:43013 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726608AbgAJI02 (ORCPT ); Fri, 10 Jan 2020 03:26:28 -0500 Received: from oxbsltgw65.schlund.de ([172.19.249.155]) by mrelayeu.kundenserver.de (mreue108 [213.165.67.113]) with ESMTPSA (Nemesis) id 1Mspu2-1jedzf1I2C-00tEUP for ; Fri, 10 Jan 2020 09:26:27 +0100 Date: Fri, 10 Jan 2020 09:26:27 +0100 (CET) From: Erik Fastermann Reply-To: Erik Fastermann To: git@vger.kernel.org Message-ID: <1032627506.120165.1578644787174@email.ionos.de> Subject: Question about the pack OBJ_OFS_DELTA format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal X-Mailer: Open-Xchange Mailer v7.10.1-Rev25 X-Originating-Client: open-xchange-appsuite X-Provags-ID: V03:K1:zB3eKXeMdT6CurTr/z8C6ckCJtUhtYX+mbHfmmeBbnRY2j3g+vZ wnEe10Rj/z59fS8V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ECW/AA4jTnS1bNKTZu+A VZCDhC9S13mpItSGcRF/NNj8blr2B2gRa5JyY7u9k= Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Hi all, I'm trying to implement the Git pack format. Parsing the index file and unpacking undeltified objects already works. However I'm unable to get the offset, if the type is OBJ_OFS_DELTA. The very much work-in-progress Go code and data can be found here: https://github.com/erikfastermann/notes/tree/wip/git >From the docs (https://git-scm.com/docs/pack-format) I assume, that the offset is a variable length integer, like the size. However my caclulation leads to a illogical result. When trying the hash 8c40ff4767d973b672fe5aa431cb8ba0593dd26a with: git verify-pack -v pack.pack I get: offset: 138650 size: 30. The base object 9b25d441c1bf358af01edc4eeba65870581a5ac1 (shown by verify-pack) has the offset 136887, which I think means the delta should be: 138650 - 136887 = 1763. Using the command: dd skip=138650 count=4 if=pack.pack bs=1 status=none | hexdump -C I get: ee 01 8c 63 The first two bytes, the type and the size are correctly computed. So the next varint should be the offset. 8c: 10001100 --- 63: 01100011 -> 1100011_0001100 -> 12684 ??? The result is the same when calculating it manually and with my program. I probably have some crucial misunderstanding about the format, so a clarification would be nice. Thank you for your help. Erik