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

[PATCH] git-sh-setup.sh: use "git rev-parse --show-cdup" to check for SUBDIRECTORY_OK

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Oct 27, 2007, 07:47 UTC
Message-ID
<20071027074721.GA12606@laptop>
"git rev-parse --git-dir" trick does not play well with worktree
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 git-sh-setup.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 3c325fd..86d7d4c 100755
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -110,7 +110,7 @@ esac
 if [ -z "$SUBDIRECTORY_OK" ]
 then
 	: ${GIT_DIR=.git}
-	GIT_DIR=$(GIT_DIR="$GIT_DIR" git rev-parse --git-dir) || {
+	test -z "$(git rev-parse --show-cdup)" || {
 		exit=$?
 		echo >&2 "You need to run this command from the toplevel of the working tree."
 		exit $exit
-- 
1.5.3.rc4.3.gab089
Message 1 of 1 in “git-sh-setup.sh: use "git rev-parse --show-cdup" to check for SUBDIRECTORY_OK”
  1. git-sh-setup.sh: use "git rev-parse --show-cdup" to check for SUBDIRECTORY_OKNguyễn Thái Ngọc Duy, Oct 27, 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.