git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brad King <brad.king@kitware.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	Avery Pennarun <apenwarr@gmail.com>,
	Lars Hjemli <hjemli@gmail.com>
Subject: [PATCH v2 0/2] Support relative .git file in a submodule
Date: Fri,  8 Jan 2010 22:36:39 -0500	[thread overview]
Message-ID: <1263008201-27429-1-git-send-email-brad.king@kitware.com> (raw)
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

  reply	other threads:[~2010-01-09  3:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-08 22:36 [PATCH 0/2] Support relative .git file in a submodule Brad King
2010-01-08 22:36 ` [PATCH 1/2] Test update-index for a gitlink to a .git file Brad King
2010-01-08 22:36 ` [PATCH 2/2] Handle relative paths in submodule .git files Brad King
2010-01-08 23:09 ` [PATCH 0/2] Support relative .git file in a submodule Junio C Hamano
2010-01-08 23:24   ` Avery Pennarun
2010-01-09  3:36     ` Brad King [this message]
2010-01-09 17:20       ` [PATCH v2 " Junio C Hamano
2010-01-09  3:36     ` [PATCH v2 1/2] Test update-index for a gitlink to a .git file Brad King
2010-01-09  3:36     ` [PATCH v2 2/2] Handle relative paths in submodule .git files Brad King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1263008201-27429-1-git-send-email-brad.king@kitware.com \
    --to=brad.king@kitware.com \
    --cc=apenwarr@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hjemli@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).