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

[PATCH v2 0/2] Support relative .git file in a submodule

From
Brad King <brad.king@kitware.com>
Date
Jan 9, 2010, 03:36 UTC
Message-ID
<1263008201-27429-1-git-send-email-brad.king@kitware.com>
In-Reply-To
<32541b131001081524g43d54a44i582dd286c1dfe7a5@mail.gmail.com>
Junio C Hamano wrote:
> then I've always thought that is simply a misconfiguration (t0002
> seems to use full path for this exact reason).
Everything in that test works with REAL=.real except the line
  test "$REAL" = "$(git rev-parse --git-dir)"
because --git-dir returns an absolute path.
> Is there a reason why relative path should be used/usable here, other
> than "being able to is better than not being able to"???
Similar configurations already work:
 - A .git file with a relative path works inside its work tree
 - A .git symlink with a relative path works inside its work tree
 - A submodule whose .git is a real symlink with a relative path works
My patch just fixes an intuitive combination of these cases.
> I don't like my process randomly chdir'ing around assuming they can
> chdir back safely very much, and would prefer not to add such
> codepaths unless absolutely necessary.

Here is a new patch series. Patch 1/2 is unchanged. Patch 2/2 has been re-written to avoid chdir.

Avery Pennarun wrote:
> This problem seems especially true with submodules.  If the
> submodule's repo is something like supermodule/.git/submodule.git, a
> relative path would almost always be a appropriate, no?

Exactly. In fact the experiment I was doing involved creating submodule repos inside the main .git and linking to them from the work tree subdirectories. I'm looking into combining the approach with that of git-new-workdir to keep submodules in the same object database.

Brad King (2):
  Test update-index for a gitlink to a .git file
  Handle relative paths in submodule .git files
 setup.c                         |   22 +++++++++++++++++++---
 t/t2104-update-index-gitfile.sh |   38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+), 3 deletions(-)
 create mode 100755 t/t2104-update-index-gitfile.sh
Previous: Avery PennarunNext: Junio C Hamano
Message 6 of 9 in “Support relative .git file in a submodule”
  1. 0/2 Support relative .git file in a submoduleBrad King, Jan 8, 2010
  2. 1/2 Test update-index for a gitlink to a .git fileBrad King, Jan 8, 2010
  3. 2/2 Handle relative paths in submodule .git filesBrad King, Jan 8, 2010
  4. Junio C HamanoJan 8, 2010
  5. Avery PennarunJan 8, 2010
  6. 0/2 Support relative .git file in a submoduleBrad King, Jan 9, 2010
  7. Junio C HamanoJan 9, 2010
  8. 1/2 Test update-index for a gitlink to a .git fileBrad King, Jan 9, 2010
  9. 2/2 Handle relative paths in submodule .git filesBrad King, Jan 9, 2010

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.