Re: [PATCH] hash: Allow building with the external sha1dc library
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 1, 2017, 15:56 UTC
- Message-ID
- <xmqqbmnzgu3z.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <s5h8tj37scz.wl-tiwai@suse.de>
Takashi Iwai <tiwai@suse.de> writes:
Show 15 quoted lines
> 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.
Thanks.