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

Re: [SQUASHED PATCH] Add support for GIT_CEILING_DIRECTORIES

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
May 17, 2008, 00:19 UTC
Message-ID
<alpine.DEB.1.00.0805170117000.30431@racer>
In-Reply-To
<482DC7B6.1080406@facebook.com>
Hi,
On Fri, 16 May 2008, David Reiss wrote:
Show 10 quoted lines
> Sorry I missed this before.  As you said, in Johannes's version the 
> ceiling directories are the last directories we look in, whereas in my 
> implementation, they are the first directories we do not look in.  I 
> made this choice because it makes more sense for me to set my ceiling to 
> "/home", rather than "/home/dreiss", so it will work even if I am in 
> another user's homedir.
> 
> There is also a difference in how they handle the case where the cwd is 
> a ceiling directory, but I think it is worth sorting out the first issue 
> first.
Please do not top-post.
This is the interdiff to the last squashed patch:
-- snip --
diff --git a/setup.c b/setup.c
index cece3e4..2f7a17a 100644
--- a/setup.c
+++ b/setup.c
@@ -441,6 +441,8 @@ const char *setup_git_directory_gently(int *nongit_ok)
 	 */
 	offset = len = strlen(cwd);
 	for (;;) {
+		if (offset <= min_offset)
+			goto non_git;
 		gitfile_dir = read_gitfile_gently(DEFAULT_GIT_DIR_ENVIRONMENT);
 		if (gitfile_dir) {
 			if (set_git_dir(gitfile_dir))
@@ -460,6 +462,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
 		chdir("..");
 		do {
 			if (offset <= min_offset) {
+non_git:
 				if (nongit_ok) {
 					if (chdir(cwd))
 						die("Cannot come back to cwd");
diff --git a/t/t1504-ceiling-directories.sh b/t/t1504-ceiling-directories.sh
index 6c8757d..edc00be 100644
--- a/t/t1504-ceiling-directories.sh
+++ b/t/t1504-ceiling-directories.sh
@@ -30,6 +30,15 @@ test_expect_success 'with non-matching ceiling directory' '
 
 '
 
+test_expect_success 'with matching ceiling directory' '
+
+	GIT_CEILING_DIRECTORIES="$CWD" &&
+	export GIT_CEILING_DIRECTORIES &&
+	(cd subdir && test_must_fail git rev-parse --git-dir) &&
+	test_must_fail git rev-parse --git-dir
+
+'
+
 test_expect_success 'with matching ceiling directories' '
 
 	GIT_CEILING_DIRECTORIES="$CWD/X:$CWD/subdir" &&
-- snap --

I will post the squashed patch as a response to this mail.

Ciao,
Dscho
Previous: David ReissNext: Johannes Schindelin
Message 13 of 20 in “Add support for GIT_CEILING_DIRS”
  1. Add support for GIT_CEILING_DIRSDavid Reiss, May 15, 2008
  2. Johannes SchindelinMay 15, 2008
  3. David ReissMay 15, 2008
  4. Add support for GIT_CEILING_DIRECTORIESJohannes Schindelin, May 15, 2008
  5. David ReissMay 15, 2008
  6. Johannes SchindelinMay 15, 2008
  7. David ReissMay 15, 2008
  8. Add support for GIT_CEILING_DIRECTORIESJohannes Schindelin, May 15, 2008
  9. Johannes SixtMay 16, 2008
  10. Johannes SchindelinMay 16, 2008
  11. Johannes SixtMay 16, 2008
  12. David ReissMay 16, 2008
  13. Johannes SchindelinMay 17, 2008
  14. Add support for GIT_CEILING_DIRECTORIESJohannes Schindelin, May 17, 2008
  15. Johannes SixtMay 19, 2008
  16. Johannes SchindelinMay 19, 2008
  17. Junio C HamanoMay 15, 2008
  18. Johannes SchindelinMay 15, 2008
  19. Johannes SixtMay 16, 2008
  20. Johannes SchindelinMay 16, 2008

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.