Re: [PATCH] build: get rid of the notion of a git library

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 10, 2013 at 5:06 PM, Jeff King <peff@xxxxxxxx> wrote:
> On Mon, Jun 10, 2013 at 04:52:57PM -0500, Felipe Contreras wrote:
>
>> On Mon, Jun 10, 2013 at 4:45 PM, Jeff King <peff@xxxxxxxx> wrote:
>>
>> > That is what libgit.a _is_ now.  I do not mean to imply any additional
>> > judgement on what it could be. But if the goal is to make libgit.a
>> > "functions that programs outside git.git would want, and nothing else",
>> > we may want to additionally split out a "libgit-internal.a" consisting
>> > of code that is used by multiple externals in git, but which would not
>> > be appropriate for clients to use.
>>
>> That might make sense, but that still doesn't clarify what belongs in
>> ./*.o, and what belongs in ./builtin/*.o. And right now that creates a
>> mess where you have code shared between ./builtin/*.o that is defined
>> in cache.h (overlay_tree_on_cache), and some in builtin.h
>> (init_copy_notes_for_rewrite). And it's not clear what should be done
>> when code in ./*.o needs to access functionality in ./builtin/*.o,
>> specially if that code is only useful for git builtins, and nothing
>> else.
>
> My general impression of the goal of our current code organization is:
>
>   1. builtin/*.c should each contain a single builtin command and its
>      supporting static functions. Each file gets linked into git.o to
>      make the "main" git executable.

We already know this is not the case. Maybe this should be fixed by
moving all the shared code between builtins to libgit.a, but maybe we
already know at some level this is not wise, and that's why we haven't
done so.

> If we want to start caring, then we probably need to create a separate
> "kitchen sink"-like library, with the rule that things in libgit.a
> cannot depend on it. In other words, a support library for Git's
> commands, for the parts that are not appropriate to expose as part of a
> library API.

Yes, that's clearly what we should be doing, which is precisely what
my patch that creates builtin/lib.a does.

So we have two options:

a) Do what we clearly should do; create builtin/lib.a, and move code
there that is specific to builtin commands.

b) Do what we think we have been doing; and move _all_ shared code to
libgit.a (which shouldn't be called libgit, because it's not really a
library), and cleanup builtin/*.c so they don't share anything among
themselves directly.

I vote for a), not only because we already know that's what we
_should_ do, but because we are basically already there.

Leaving things as they are is not really an option; that's a mess.

-- 
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]