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

Re: [PATCH] Makefile: allow NO_DC_SHA1_SUBMODULE to be set in config.mak

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Dec 12, 2017, 23:21 UTC
Message-ID
<877etrcz28.fsf@evledraar.gmail.com>
In-Reply-To
<xmqqy3m7y2mz.fsf@gitster.mtv.corp.google.com>
On Tue, Dec 12 2017, Junio C. Hamano jotted:
Show 24 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>>
>>>> I actually think that the block can go even further down, perhaps
>>>> close to the run of choices "what variant are we building?" we make
>>>> at around we have "ifdef NO_CURL".
>>>>
>>>> Ævar?
>>>
>>> Makes sense to me, do you want to squash this + your proposed edit &
>>> I'll pick it up if there's another version, or I can re-submit.
>>
>> OK.  I'll squash in the 'move it further down' to the original
>> commit that removed DC_SHA1_SUBMODULE and added NO_DC_SHA1_SUBMODULE
>> when rebuilding 'pu' branch.
>>
>> Thanks.
>
> Another minor thing I noticed (which I do not have any squashable
> fix for) is that "make distclean" does not even work without
> submodule or this environment, which feels a bit too excessive.  I
> haven't tried to figure out how involved a fix for that would be yet
> and I do not mind leaving it broken if it would be too much work.

Yes, that sucks. I can't think of a better fix for it than this massive hack of outsourcing printing the error to the header itself, which'll only be executed if we actually compile:

    diff --git a/Makefile b/Makefile
    index ba3e061edd..881cf55159 100644
    --- a/Makefile
    +++ b/Makefile
    @@ -1022,9 +1022,7 @@ GIT_USER_AGENT = git/$(GIT_VERSION)
     ifndef DC_SHA1_EXTERNAL
            ifneq ($(wildcard sha1collisiondetection/lib/sha1.h),sha1collisiondetection/lib/sha1.h)
    -$(error The sha1collisiondetection submodule is not checked out. \
    -Please make it available, either by cloning with --recurse-submodules, \
    -or by running "git submodule update --init".)
    +               BASIC_CFLAGS += -DERROR_SHA1COLLISIONDETECTION_SUBMODULE
            endif
     else
            ifdef NO_DC_SHA1_SUBMODULE
    diff --git a/sha1dc_git.h b/sha1dc_git.h
    index be1d48abbe..93a9be976a 100644
    --- a/sha1dc_git.h
    +++ b/sha1dc_git.h
    @@ -1,5 +1,11 @@
     /* Plumbing with collition-detecting SHA1 code */
    +#ifdef ERROR_SHA1COLLISIONDETECTION_SUBMODULE
    +#error "The sha1collisiondetection submodule is not checked out." \
    +       "Please make it available, either by cloning with --recurse-submodules," \
    +       "or by running \"git submodule update --init\"."
    +#endif
    +
     #ifdef DC_SHA1_EXTERNAL
     #include <sha1dc/sha1.h>
     #else

But maybe I missed a way to make the $(error) path work only if certain targets were about to be compiled.

Previous: Junio C Hamano
Message 8 of 8 in “Makefile: allow NO_DC_SHA1_SUBMODULE to be set in config.mak”
  1. Makefile: allow NO_DC_SHA1_SUBMODULE to be set in config.makRamsay Jones, Dec 12, 2017
  2. Junio C HamanoDec 12, 2017
  3. Junio C HamanoDec 12, 2017
  4. Jonathan TanDec 12, 2017
  5. Ævar Arnfjörð BjarmasonDec 12, 2017
  6. Junio C HamanoDec 12, 2017
  7. Junio C HamanoDec 12, 2017
  8. Ævar Arnfjörð BjarmasonDec 12, 2017

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.