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

Re: Adding nested repository with slash adds files instead of gitlink

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Aug 13, 2024, 12:48 UTC
Message-ID
<8436c2bf-45cf-8009-14cd-c5ca708ece08@gmx.de>
In-Reply-To
<xmqqed6zht04.fsf@gitster.g>
Hi,
On Thu, 8 Aug 2024, Junio C Hamano wrote:
Show 27 quoted lines
> Phil Sainty <phil@catalyst.net.nz> writes:
>
> >> On Wed, Jun 20, 2018 at 1:55 PM Rafael Ascensão <rafa.almas@gmail.com> wrote:
> >> > On Wed, Jun 20, 2018 at 5:39 AM Kevin Daudt <me@ikke.info> wrote:
> >> > > What this is about that when doing `git add path/` (with trailing /),
> >> >
> >> > This is what I was referring to. If you search for 'Fake Submodules',
> >> > you'll see that some people were/are intentionally using this instead of
> >> > subtrees or submodules. Unfortunately the original article [1] seems to
> >> > be dead, but searching url in the mailing list archives leads to some
> >> > additional discussion on the subject [2,3].
> >>
> >> Abusing a long standing bug does not make it a feature. I'm not
> >> opposed to having a new option to keep that behavior, but it should
> >> not be the default. If you use it that way, you're on your own.
> >
> > Was such an option ever worked on?
>
> No.
>
> I do not recall hearing anybody who have been active in the
> development community saying anything good about such an option.
> For the past 6 or so years, nobody who actively works on git thought
> it was an interesting and/or useful thing to work on.
>
> I cannot quite say that they thought that it is actively a bad idea
> to offer such an option, though.

I have encountered the wish quite frequently to be able to make changes in a subdirectory and have them reflected as a commit that is both part of that subdirectory's revision history as well as part of the containing project's.

The benefits for monorepos, and for reproducible builds, are probably obvious.

Sadly, I cannot think of an elegant technical design, and this is not for lack of trying.

There are lots of projects I worked on that would have benefitted from being able to track a subdirectory both independently as well as within the context of a containing project, i.e. offering to view (and fetch/push) the changesets in both contexts as equal first citizens.

Even the Git and libxdiff projects, as a concrete example, could potentially have benefitted from such a feature: Ideally, it should be possible to push commits made in the `xdiff/` directory not only to the git/git repository but also separately from the rest of Git, say, to xdiff/libxdiff. This way, the `libxdiff` project would still be able today to thrive as an independent project.

The only way to implement a feature like this that I _can_ think of is to generate duplicate commit objects, though, with a reference to the "inner" commit stored in the "outer" commit object. And that strategy breaks down really quickly, no matter whether I think about deep dependency trees or about integrating commit histories that have been made in the "inner" project separately and now need to be merged into the "outer" project, and there are many more processes for which this strategy strikes me as inadequate.

So yes, I think that the idea per se has a lot of merit in the real world out there. It's the implementation details that are an obstacle.

Ciao, Johannes

Previous: Junio C HamanoNext: Junio C Hamano
Message 19 of 22 in “Adding nested repository with slash adds files instead of gitlink”
  1. Heiko VoigtJun 18, 2018
  2. Duy NguyenJun 18, 2018
  3. Brandon WilliamsJun 18, 2018
  4. Heiko VoigtJun 19, 2018
  5. Duy NguyenJun 19, 2018
  6. Junio C HamanoJun 19, 2018
  7. Duy NguyenJun 19, 2018
  8. Duy NguyenJun 19, 2018
  9. Duy NguyenJun 19, 2018
  10. Kevin DaudtJun 18, 2018
  11. Heiko VoigtJun 19, 2018
  12. Rafael AscensãoJun 19, 2018
  13. Kevin DaudtJun 20, 2018
  14. Rafael AscensãoJun 20, 2018
  15. Duy NguyenJun 20, 2018
  16. Rafael AscensãoJun 20, 2018
  17. Phil SaintyAug 8, 2024
  18. Junio C HamanoAug 8, 2024
  19. Johannes SchindelinAug 13, 2024
  20. Junio C HamanoAug 13, 2024
  21. Phil SaintyAug 13, 2024
  22. Johannes SchindelinAug 14, 2024

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.