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

[PATCH] t1500: extend with tests of 'git rev-parse --git-dir'

From
SZEDER Gábor <szeder@ira.uka.de>
Date
Jan 19, 2009, 02:08 UTC
Message-ID
<20090119020841.GA9798@neumann>
In-Reply-To
<7vhc3wuwxb.fsf@gitster.siamese.dyndns.org>
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
  These will pass with Junio's follow-up.
 t/t1500-rev-parse.sh |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/t/t1500-rev-parse.sh b/t/t1500-rev-parse.sh
index 85da4ca..48ee077 100755
--- a/t/t1500-rev-parse.sh
+++ b/t/t1500-rev-parse.sh
@@ -26,21 +26,28 @@ test_rev_parse() {
 	"test '$1' = \"\$(git rev-parse --show-prefix)\""
 	shift
 	[ $# -eq 0 ] && return
+
+	test_expect_success "$name: git-dir" \
+	"test '$1' = \"\$(git rev-parse --git-dir)\""
+	shift
+	[ $# -eq 0 ] && return
 }
 
-# label is-bare is-inside-git is-inside-work prefix
+# label is-bare is-inside-git is-inside-work prefix git-dir
+
+ROOT=$(pwd)
 
-test_rev_parse toplevel false false true ''
+test_rev_parse toplevel false false true '' .git
 
 cd .git || exit 1
-test_rev_parse .git/ false true false ''
+test_rev_parse .git/ false true false '' .
 cd objects || exit 1
-test_rev_parse .git/objects/ false true false ''
+test_rev_parse .git/objects/ false true false '' "$ROOT/.git"
 cd ../.. || exit 1
 
 mkdir -p sub/dir || exit 1
 cd sub/dir || exit 1
-test_rev_parse subdirectory false false true sub/dir/
+test_rev_parse subdirectory false false true sub/dir/ "$ROOT/.git"
 cd ../.. || exit 1
 
 git config core.bare true
-- 
1.6.1.201.g0e7e.dirty
Previous: Johannes Sixt
Message 12 of 12 in “Fix gitdir detection when in subdir of gitdir”
  1. Fix gitdir detection when in subdir of gitdirSZEDER Gábor, Jan 16, 2009
  2. Johannes SchindelinJan 16, 2009
  3. Johannes SixtJan 16, 2009
  4. Johannes SixtJan 16, 2009
  5. SZEDER GáborJan 16, 2009
  6. Junio C HamanoJan 16, 2009
  7. Johannes SchindelinJan 16, 2009
  8. Junio C HamanoJan 18, 2009
  9. SZEDER GáborJan 19, 2009
  10. Junio C HamanoJan 19, 2009
  11. Johannes SixtJan 19, 2009
  12. t1500: extend with tests of 'git rev-parse --git-dir'SZEDER Gábor, Jan 19, 2009

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.