git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Git Mailing List" <git@vger.kernel.org>,
	"Andreas Stieger" <astieger@suse.com>
Subject: Re: [PATCH] hash: Allow building with the external sha1dc library
Date: Tue, 01 Aug 2017 18:12:10 +0200	[thread overview]
Message-ID: <s5hmv7jw9lx.wl-tiwai@suse.de> (raw)
In-Reply-To: <xmqqbmnzgu3z.fsf@gitster.mtv.corp.google.com>

On Tue, 01 Aug 2017 17:56:00 +0200,
Junio C Hamano wrote:
> 
> Takashi Iwai <tiwai@suse.de> writes:
> 
> > On Fri, 28 Jul 2017 17:58:14 +0200,
> > Ævar Arnfjörð Bjarmason wrote:
> >>  ...
> >> * We now have much of the same header code copy/pasted between
> >> sha1dc_git.h and sha1dc_git_ext.h, did you consider just always
> >> including the former but making what it's doing conditional on
> >> DC_SHA1_EXTERNAL? I don't know if it would be worth it from a cursory
> >> glance, but again your commit message doesn't list that among options
> >> considered & discarded.
> >
> > I don't mind either way, there is no perfect solution in this case.
> > As you know, many people think the ifdef ugly no matter how.
> >
> > I leave the decision to maintainer.  Just let me know which option is
> > preferred.
> 
> Yeah, I also found it somewhat confusing to have these two headers
> that look quite similar to each other at the top-level of the tree.
> 
> What's the "conditional" part between the two headers?  Is it just
> whether the header for underlying library is included?  I wonder if
> it's just the matter of adjusting "hash.h" to read like this
> 
>     ...
>     #if defined(DC_SHA1_EXTERNAL)
>    -#include "sha1dc_git_ext.h"
>    +#include <sha1dc/sha1.h>
>    +#include "sha1dc_git.h"
>     #elif  defined(DC_SHA1_SUBMODULE)
>     ...
> 
> or are there heavier tweaks needed that won't be solved by continuing
> along the same line?  As _ext.h variant is included only at this place,
> if we can do with minimum tweaks around here without introducing it,
> it may be ideal, I would think.

Well, a tricky part is that currently sha1dc_git.h is included from
sha1dc/sha1.h implicitly by SHA1DC_CUSTOM_TRAILING_INCLUDE_SHA1_H
definition.  IMO, we should stop this, and use the standard inclusion
instead, i.e. in hash.h,

#if defined(DC_SHA1_EXTERNAL)
#include <sha1dc/sha1.h>
#elif defined(DC_SHA1_SUBMODULE)
#include "sha1collisiondetection/lib/sha1.h"
#else
#include "sha1dc/sha1.h"
#endif
#include "sha1dc_git.h"

In sha1dc_git.h, we'd need another ifdef for DC_SHA1_EXTERNAL to
define the own git_SHA1DCInit(), but it's trivial. 


Takashi

  reply	other threads:[~2017-08-01 16:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-25  5:57 [PATCH] hash: Allow building with the external sha1dc library Takashi Iwai
2017-07-25 19:06 ` Junio C Hamano
2017-07-28 15:58 ` Ævar Arnfjörð Bjarmason
2017-07-28 16:04   ` Ævar Arnfjörð Bjarmason
2017-07-31 22:28     ` Junio C Hamano
2017-08-01  5:52     ` Takashi Iwai
2017-08-12  0:42     ` Junio C Hamano
2017-08-12  6:50       ` Takashi Iwai
2017-08-01  5:46   ` Takashi Iwai
2017-08-01 15:56     ` Junio C Hamano
2017-08-01 16:12       ` Takashi Iwai [this message]
2017-08-01 19:55         ` Ævar Arnfjörð Bjarmason
2017-08-01 20:50           ` Takashi Iwai

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hmv7jw9lx.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=astieger@suse.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
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 NNTP newsgroup(s).