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

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

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Jun 10, 2013, 22:22 UTC
Message-ID
<CAMP44s0H4ET_Bfc0tFuxSagFO+ycq_U3RY65fqGsqh=0Y-YKPw@mail.gmail.com>
In-Reply-To
<20130610220627.GB28345@sigill.intra.peff.net>
On Mon, Jun 10, 2013 at 5:06 PM, Jeff King <peff@peff.net> wrote:
Show 25 quoted lines
> 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@peff.net> 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.

Show 5 quoted lines
> 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
Previous: Jeff KingNext: Junio C Hamano
Message 21 of 59 in “build: get rid of the notion of a git library”
  1. build: get rid of the notion of a git libraryFelipe Contreras, Jun 8, 2013
  2. Ramkumar RamachandraJun 8, 2013
  3. Felipe ContrerasJun 8, 2013
  4. Ramkumar RamachandraJun 9, 2013
  5. John KeepingJun 9, 2013
  6. Felipe ContrerasJun 9, 2013
  7. John KeepingJun 9, 2013
  8. Felipe ContrerasJun 9, 2013
  9. John KeepingJun 9, 2013
  10. Ramkumar RamachandraJun 9, 2013
  11. Ramkumar RamachandraJun 9, 2013
  12. Felipe ContrerasJun 9, 2013
  13. John KeepingJun 9, 2013
  14. Felipe ContrerasJun 9, 2013
  15. Ramkumar RamachandraJun 9, 2013
  16. Vincent van RavesteijnJun 9, 2013
  17. Felipe ContrerasJun 9, 2013
  18. Jeff KingJun 10, 2013
  19. Felipe ContrerasJun 10, 2013
  20. Jeff KingJun 10, 2013
  21. Felipe ContrerasJun 10, 2013
  22. Junio C HamanoJun 10, 2013
  23. Junio C HamanoJun 10, 2013
  24. Felipe ContrerasJun 10, 2013
  25. Junio C HamanoJun 11, 2013
  26. Junio C HamanoJun 11, 2013
  27. Felipe ContrerasJun 11, 2013
  28. Junio C HamanoJun 11, 2013
  29. Felipe ContrerasJun 11, 2013
  30. Junio C HamanoJun 11, 2013
  31. Felipe ContrerasJun 11, 2013
  32. Linus TorvaldsJun 11, 2013
  33. Felipe ContrerasJun 11, 2013
  34. Junio C HamanoJun 11, 2013
  35. Felipe ContrerasJun 11, 2013
  36. 0/3 Refactor useful notes functions into notes-utils.[ch]Johan Herland, Jun 12, 2013
  37. 1/3 finish_copy_notes_for_rewrite(): Let caller provide commit messageJohan Herland, Jun 12, 2013
  38. Junio C HamanoJun 12, 2013
  39. 2/3 Move copy_note_for_rewrite + friends from builtin/notes.c to notes-utils.cJohan Herland, Jun 12, 2013
  40. Felipe ContrerasJun 12, 2013
  41. Johan HerlandJun 12, 2013
  42. Felipe ContrerasJun 12, 2013
  43. Johan HerlandJun 12, 2013
  44. Felipe ContrerasJun 12, 2013
  45. Andreas KreyJun 13, 2013
  46. Felipe ContrerasJun 13, 2013
  47. Junio C HamanoJun 12, 2013
  48. 3/3 Move create_notes_commit() from notes-merge.c into notes-utils.cJohan Herland, Jun 12, 2013
  49. Junio C HamanoJun 12, 2013
  50. Felipe ContrerasJun 12, 2013
  51. Junio C HamanoJun 13, 2013
  52. Felipe ContrerasJun 13, 2013
  53. Felipe ContrerasJun 13, 2013
  54. Junio C HamanoJun 11, 2013
  55. Felipe ContrerasJun 11, 2013
  56. Junio C HamanoJun 11, 2013
  57. Felipe ContrerasJun 11, 2013
  58. Felipe ContrerasJun 11, 2013
  59. Felipe ContrerasJun 9, 2013

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.