git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>,
	"Mark Levedahl" <mlevedahl@gmail.com>,
	"Git Mailing List" <git@vger.kernel.org>
Subject: Re: [PATCH] Fix install-doc-quick target
Date: Sun, 5 Aug 2007 15:44:02 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0708051533590.14781@racer.site> (raw)
In-Reply-To: <7vmyx6fohv.fsf_-_@assigned-by-dhcp.cox.net>

Hi,

On Sun, 5 Aug 2007, Junio C Hamano wrote:

>    If you say:
> 
> 	git --work-tree=. foo
> 
>    without saying anything about GIT_DIR, shouldn't we run the
>    usual .git/ discovery, going up the directories? 

Well, it seems natural.

The problem is that if you are in a bare repository, after 
setup_git_directory_gently() you will no longer be able to tell where you 
started from, but you are in the same directory that HEAD was found.

I had the following patch, but it breaks all kinds of tests :-(

Will keep you posted,
Dscho

-- snipsnap --

 setup.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/setup.c b/setup.c
index d87e4e1..c627623 100644
--- a/setup.c
+++ b/setup.c
@@ -291,7 +291,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
 			if (!work_tree_env)
 				inside_work_tree = 0;
 			setenv(GIT_DIR_ENVIRONMENT, ".", 1);
-			return NULL;
+			goto ret;
 		}
 		chdir("..");
 		do {
@@ -311,6 +311,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
 	if (!work_tree_env)
 		inside_work_tree = 1;
 	git_work_tree_cfg = xstrndup(cwd, offset);
+ret:
 	if (offset == len)
 		return NULL;
 
@@ -376,14 +377,15 @@ const char *setup_git_directory(void)
 	/* If the work tree is not the default one, recompute prefix */
 	if (inside_work_tree < 0) {
 		static char buffer[PATH_MAX + 1];
+		const char *git_dir = get_git_dir();
 		char *rel;
 
 		/*
 		 * When the git dir was determined automatically, it is
 		 * a relative path.
 		 */
-		if (!getenv(GIT_DIR_ENVIRONMENT))
-			set_git_dir(make_absolute_path(get_git_dir()));
+		if (!is_absolute_path(git_dir))
+			set_git_dir(make_absolute_path(git_dir));
 
 		if (retval && chdir(retval))
 			die ("Could not jump back into original cwd");

  parent reply	other threads:[~2007-08-05 14:44 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-04 15:07 rc4 - make quick-install-doc is broken Mark Levedahl
2007-08-04 15:38 ` Johannes Schindelin
2007-08-04 16:00   ` Mark Levedahl
2007-08-04 16:04     ` Johannes Schindelin
2007-08-04 16:14       ` Mark Levedahl
2007-08-04 16:21         ` Johannes Schindelin
2007-08-04 17:56           ` Mark Levedahl
2007-08-04 21:32             ` [PATCH] Fix quick-install-doc Johannes Schindelin
2007-08-04 22:09               ` René Scharfe
2007-08-05  7:07                 ` [PATCH] Fix install-doc-quick target Junio C Hamano
2007-08-05 13:12                   ` Johannes Schindelin
2007-08-05 17:54                     ` Junio C Hamano
2007-08-05 18:10                       ` Johannes Schindelin
2007-08-05 14:44                   ` Johannes Schindelin [this message]
2007-08-06 22:43                   ` [PATCH] (Really) " Mark Levedahl
2007-08-06 22:50                     ` Johannes Schindelin
2007-08-06 23:07                       ` Junio C Hamano
2007-08-06 23:38                         ` Mark Levedahl
2007-08-06 23:43                           ` Johannes Schindelin
2007-08-06 23:49                             ` Mark Levedahl
2007-08-07  1:28                           ` Junio C Hamano
2007-08-07  1:55                             ` Mark Levedahl
2007-08-07  3:53                               ` Junio C Hamano
2007-08-07 13:55                                 ` René Scharfe
2007-08-07 14:08                                   ` Johannes Schindelin
2007-08-04 16:08     ` rc4 - make quick-install-doc is broken Mark Levedahl
2007-08-04 16:16       ` Johannes Schindelin
2007-08-04 16:27         ` Mark Levedahl
2007-08-04 20:19     ` René Scharfe
2007-08-04 20:21       ` Johannes Schindelin
2007-08-04 20:45       ` Mark Levedahl
2007-08-04 21:33       ` Johannes Schindelin
2007-08-04 22:09         ` René Scharfe
2007-08-04 22:25           ` Johannes Schindelin
2007-08-04 22:37           ` Johannes Schindelin
2007-08-04 23:03             ` René Scharfe

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=Pine.LNX.4.64.0708051533590.14781@racer.site \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mlevedahl@gmail.com \
    --cc=rene.scharfe@lsrfire.ath.cx \
    /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).