Re: [PATCH] Fix install-doc-quick target

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Junio C Hamano <gitster@...>
Cc: <rene.scharfe@...>, Mark Levedahl <mlevedahl@...>, Git Mailing List <git@...>
Date: Sunday, August 5, 2007 - 10:44 am

Hi,

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


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");
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
rc4 - make quick-install-doc is broken, Mark Levedahl, (Sat Aug 4, 11:07 am)
Re: rc4 - make quick-install-doc is broken, Johannes Schindelin, (Sat Aug 4, 11:38 am)
Re: rc4 - make quick-install-doc is broken, Mark Levedahl, (Sat Aug 4, 12:00 pm)
Re: rc4 - make quick-install-doc is broken, Johannes Schindelin, (Sat Aug 4, 5:33 pm)
Re: rc4 - make quick-install-doc is broken, Johannes Schindelin, (Sat Aug 4, 6:37 pm)
Re: rc4 - make quick-install-doc is broken, Johannes Schindelin, (Sat Aug 4, 6:25 pm)
Re: rc4 - make quick-install-doc is broken, Mark Levedahl, (Sat Aug 4, 4:45 pm)
Re: rc4 - make quick-install-doc is broken, Johannes Schindelin, (Sat Aug 4, 4:21 pm)
Re: rc4 - make quick-install-doc is broken, Johannes Schindelin, (Sat Aug 4, 12:04 pm)
Re: rc4 - make quick-install-doc is broken, Mark Levedahl, (Sat Aug 4, 12:14 pm)
Re: rc4 - make quick-install-doc is broken, Johannes Schindelin, (Sat Aug 4, 12:21 pm)
Re: rc4 - make quick-install-doc is broken, Mark Levedahl, (Sat Aug 4, 1:56 pm)
[PATCH] Fix quick-install-doc, Johannes Schindelin, (Sat Aug 4, 5:32 pm)
Re: [PATCH] Fix quick-install-doc, , (Sat Aug 4, 6:09 pm)
[PATCH] Fix install-doc-quick target, Junio C Hamano, (Sun Aug 5, 3:07 am)
[PATCH] (Really) Fix install-doc-quick target, Mark Levedahl, (Mon Aug 6, 6:43 pm)
Re: [PATCH] (Really) Fix install-doc-quick target, Johannes Schindelin, (Mon Aug 6, 6:50 pm)
Re: [PATCH] (Really) Fix install-doc-quick target, Junio C Hamano, (Mon Aug 6, 7:07 pm)
Re: [PATCH] (Really) Fix install-doc-quick target, Mark Levedahl, (Mon Aug 6, 7:38 pm)
Re: [PATCH] (Really) Fix install-doc-quick target, Junio C Hamano, (Mon Aug 6, 9:28 pm)
Re: [PATCH] (Really) Fix install-doc-quick target, Mark Levedahl, (Mon Aug 6, 9:55 pm)
Re: [PATCH] (Really) Fix install-doc-quick target, Junio C Hamano, (Mon Aug 6, 11:53 pm)
Re: [PATCH] (Really) Fix install-doc-quick target, Johannes Schindelin, (Tue Aug 7, 10:08 am)
Re: [PATCH] (Really) Fix install-doc-quick target, Johannes Schindelin, (Mon Aug 6, 7:43 pm)
Re: [PATCH] (Really) Fix install-doc-quick target, Mark Levedahl, (Mon Aug 6, 7:49 pm)
Re: [PATCH] Fix install-doc-quick target, Johannes Schindelin, (Sun Aug 5, 10:44 am)
Re: [PATCH] Fix install-doc-quick target, Johannes Schindelin, (Sun Aug 5, 9:12 am)
Re: [PATCH] Fix install-doc-quick target, Junio C Hamano, (Sun Aug 5, 1:54 pm)
Re: [PATCH] Fix install-doc-quick target, Johannes Schindelin, (Sun Aug 5, 2:10 pm)
Re: rc4 - make quick-install-doc is broken, Mark Levedahl, (Sat Aug 4, 12:08 pm)
Re: rc4 - make quick-install-doc is broken, Johannes Schindelin, (Sat Aug 4, 12:16 pm)
Re: rc4 - make quick-install-doc is broken, Mark Levedahl, (Sat Aug 4, 12:27 pm)