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 11, 2013, 19:01 UTC
Message-ID
<CAMP44s3SL7qs-Pmfz=kV-4U5OnPedK2RDLZDOyU-eq8WebLt+Q@mail.gmail.com>
In-Reply-To
<7vd2rsbjgr.fsf@alter.siamese.dyndns.org>
On Tue, Jun 11, 2013 at 1:17 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 9 quoted lines
> Felipe Contreras <felipe.contreras@gmail.com> writes:
>
>> Moreover, if you are going to argue that we shouldn't be closing the
>> door, then why not link ./builtin/*.o to libgit.a?
>
> Huh?  It does not make any sense.  builtin/*.o files have cmd_foo()
> that are expected to be called from git.c::main(), but libgit.a
> files are linked with no constraints whose main() they are linking
> with.
Show 15 quoted lines
>> If you are
>> seriously considering the highly unlikely hypothetical standalone
>> git-filter-branch scenario, you should consider the even more likely
>> scenario where somebody needs to access code from ./builtin/*.o; that
>> scenario is not even hypothetical, we know it's happened multiple
>> times, and we know it's going to happen again.
>
> That is exactly why I said that builtin/*.o should be refactored to
> pick "does not have to be in builtin" bits, which will result in a
> better division of labor.  Reusable bits should live in the library,
> while a particular implementation of command remain in builtin/*
> that utilize the reusable bits.
>
> You still haven't justified why we have to _forbid_ any outside
> callers from calling copy_notes_for_rewrite().

Because only builtins _should_ use it. I asked you for an example, and you said a hypothetical standalone 'git-filter-branch' might use it, but you have not explained why it should be standalone, when it's clear it should be a builtin.

If we assume your argument is valid for the hypothetical 'git-filter-branch', if that's the case, then it would be even more reasonable to assume that there will be other standalone binaries that would want to use all sort of functions from ./builtin/*.o. Let's put an example: reset_index(). Some standalone program wants to use that function. What do you we do?

The shortest route is to make it non-static, and add it to builtin.h. But that would not be enough, we need the infrastructure prepared for that; link libgit.a with ./builtin/*.o.

I don't think that's the way to go, but your line of argumentation leads directly there; if we are worrying about anything that any potential standalone program could want, then we should worry about reset_index() not being easily accessible to them.

IMO we should be clear and say no; standalone programs should not access copy_notes_for_rewrite(), that's for builtins. If we move all the code that potential standalone programs could want to libgit.a, it wouldn't be a library at all, and it would basically contain everything.

-- 
Felipe Contreras
Previous: Junio C HamanoNext: Junio C Hamano
Message 55 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.