git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] pack-objects: move builtin-only code to its own header

From
Junio C Hamano <gitster@pobox.com>
Date
May 27, 2021, 03:14 UTC
Message-ID
<xmqqa6ogamwb.fsf@gitster.g>
In-Reply-To
<patch-1.1-d085d59a417-20210527T005213Z-avarab@gmail.com>
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
> Move the code that's only used in builtin/pack-objects.c to a new
> builtin/pack-objects.h header and out of pack-objects.h.

I've amended the early part of the proposed log message in preparation for merging it to 'next' and then later down to 'master'.

Here is what the result looks like.
Thanks.
Author: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date:   Thu May 27 02:52:51 2021 +0200
    pack-objects: move static inline from a header to its sole consumer
    
    Move the code that is only used in builtin/pack-objects.c out of
    pack-objects.h.
    
    This fixes an issue where Solaris's SunCC hasn't been able to compile
    git since 483fa7f42d9 (t/helper/test-bitmap.c: initial commit,
    2021-03-31).
    
    The real origin of that issue is that in 898eba5e630 (pack-objects:
    refer to delta objects by index instead of pointer, 2018-04-14)
    utility functions only needed by builtin/pack-objects.c were added to
    pack-objects.h. Since then the header has been used in a few other
    places, but 483fa7f42d9 was the first time it was used by test helper.
    
    Since Solaris is stricter about linking and the oe_get_size_slow()
    function lives in builtin/pack-objects.c the build started failing
    with:
    
        Undefined                       first referenced
         symbol                             in file
        oe_get_size_slow                    t/helper/test-bitmap.o
        ld: fatal: symbol referencing errors. No output written to t/helper/test-tool
    
    On other platforms this is presumably OK because the compiler and/or
    linker detects that the "static inline" functions that reference
    oe_get_size_slow() aren't used.
    
    Let's solve this by moving the relevant code from pack-objects.h to
    builtin/pack-objects.c. This is almost entirely a code-only move, but
    because of the early macro definitions in that file referencing some
    of these inline functions we need to move the definition of "static
    struct packing_data to_pack" earlier, and declare these inline
    functions above the macros.
    
    Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Previous: Junio C HamanoNext: Ævar Arnfjörð Bjarmason
Message 10 of 13 in “pack-objects: introduce pack.preferBitmapTips”
  1. 0/3 pack-objects: introduce pack.preferBitmapTipsTaylor Blau, Apr 1, 2021
  2. 1/3 pack-bitmap: add 'test_bitmap_commits()' helperTaylor Blau, Apr 1, 2021
  3. 2/3 t/helper/test-bitmap.c: initial commitTaylor Blau, Apr 1, 2021
  4. SunCC doesn't compile v2.32.0-rc* anymore (was "Re: [PATCH 2/3] t/helper/test-bitmap.c: initial commit")Ævar Arnfjörð Bjarmason, May 26, 2021
  5. Taylor BlauMay 26, 2021
  6. Ævar Arnfjörð BjarmasonMay 26, 2021
  7. pack-objects: move builtin-only code to its own headerÆvar Arnfjörð Bjarmason, May 27, 2021
  8. Junio C HamanoMay 27, 2021
  9. Junio C HamanoMay 27, 2021
  10. Junio C HamanoMay 27, 2021
  11. Ævar Arnfjörð BjarmasonMay 27, 2021
  12. 3/3 builtin/pack-objects.c: respect 'pack.preferBitmapTips'Taylor Blau, Apr 1, 2021
  13. Derrick StoleeApr 1, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.