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

[PATCH v2 1/2] Check DB_ENVIRONMENT using is_directory()

From
tboegi@web.de <tboegi@web.de>
Date
Jul 1, 2017, 12:50 UTC
Message-ID
<20170701125057.16169-1-tboegi@web.de>
In-Reply-To
<20170628162958.519-1-tboegi@web.de>
From: Torsten Bögershausen <tboegi@web.de>

In setup.c is_git_directory() checks a Git directory using access(X_OK). This does not check, if path is a file or a directory. Check path with is_directory() instead. --- After all the discussions (and lots of tests) I found that this patch works for my setup. All in all could the error reporting be improvved for is_git_directory(), as there may be "access denied", or "not a directory" or others, but that is for another day.

setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.c b/setup.c
index 358fbc2..5a7ee2e 100644
--- a/setup.c
+++ b/setup.c
@@ -321,7 +321,7 @@ int is_git_directory(const char *suspect)
 
 	/* Check non-worktree-related signatures */
 	if (getenv(DB_ENVIRONMENT)) {
-		if (access(getenv(DB_ENVIRONMENT), X_OK))
+		if (!is_directory(getenv(DB_ENVIRONMENT)))
 			goto done;
 	}
 	else {
-- 
2.10.0
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 7 in “cygwin: Allow pushing to UNC paths”
  1. 1/1 cygwin: Allow pushing to UNC pathstboegi@web.de, Jun 28, 2017
  2. Junio C HamanoJun 28, 2017
  3. 1/2 Check DB_ENVIRONMENT using is_directory()tboegi@web.de, Jul 1, 2017
  4. Junio C HamanoJul 1, 2017
  5. 1/1 cygwin: Allow pushing to UNC pathstboegi@web.de, Jul 3, 2017
  6. Junio C HamanoJul 5, 2017
  7. 2/2 cygwin: Allow pushing to UNC pathstboegi@web.de, Jul 1, 2017

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.