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

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

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Aug 5, 2007, 14:44 UTC
Message-ID
<Pine.LNX.4.64.0708051533590.14781@racer.site>
In-Reply-To
<7vmyx6fohv.fsf_-_@assigned-by-dhcp.cox.net>
Hi,
On Sun, 5 Aug 2007, Junio C Hamano wrote:
Show 6 quoted lines
>    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");
Previous: Johannes SchindelinNext: Mark Levedahl
Message 14 of 36 in “rc4 - make quick-install-doc is broken”
  1. Mark LevedahlAug 4, 2007
  2. Johannes SchindelinAug 4, 2007
  3. Mark LevedahlAug 4, 2007
  4. Johannes SchindelinAug 4, 2007
  5. Mark LevedahlAug 4, 2007
  6. Johannes SchindelinAug 4, 2007
  7. Mark LevedahlAug 4, 2007
  8. Fix quick-install-docJohannes Schindelin, Aug 4, 2007
  9. René ScharfeAug 4, 2007
  10. Fix install-doc-quick targetJunio C Hamano, Aug 5, 2007
  11. Johannes SchindelinAug 5, 2007
  12. Junio C HamanoAug 5, 2007
  13. Johannes SchindelinAug 5, 2007
  14. Johannes SchindelinAug 5, 2007
  15. (Really) Fix install-doc-quick targetMark Levedahl, Aug 6, 2007
  16. Johannes SchindelinAug 6, 2007
  17. Junio C HamanoAug 6, 2007
  18. Mark LevedahlAug 6, 2007
  19. Johannes SchindelinAug 6, 2007
  20. Mark LevedahlAug 6, 2007
  21. Junio C HamanoAug 7, 2007
  22. Mark LevedahlAug 7, 2007
  23. Junio C HamanoAug 7, 2007
  24. René ScharfeAug 7, 2007
  25. Johannes SchindelinAug 7, 2007
  26. Mark LevedahlAug 4, 2007
  27. Johannes SchindelinAug 4, 2007
  28. Mark LevedahlAug 4, 2007
  29. René ScharfeAug 4, 2007
  30. Johannes SchindelinAug 4, 2007
  31. Mark LevedahlAug 4, 2007
  32. Johannes SchindelinAug 4, 2007
  33. René ScharfeAug 4, 2007
  34. Johannes SchindelinAug 4, 2007
  35. Johannes SchindelinAug 4, 2007
  36. René ScharfeAug 4, 2007

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.