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

[PATCH] t990X: use '.git/objects' as 'deep inside .git' path

From
Christian Couder <christian.couder@gmail.com>
Date
May 26, 2018, 06:47 UTC
Message-ID
<20180526064745.20199-1-chriscool@tuxfamily.org>

Tests t9902-completion.sh and t9903-bash-prompt.sh each have tests that check what happens when we are "in the '.git' directory" and when we are "deep inside the '.git' directory".

To test the case when we are "deep inside the '.git' directory" the test scripts used to perform a `cd .git/refs/heads`.

As there are plans to implement other ref storage systems, let's use '.git/objects' instead of '.git/refs/heads' as the "deep inside the '.git' directory" path.

This makes it clear to readers that these tests do not depend on which ref backend is used.

The internals of the loose refs backend are still tested in t1400-update-ref.sh.

Helped-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 t/t9902-completion.sh  | 2 +-
 t/t9903-bash-prompt.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 36deb0b123..a28640ce1a 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -181,7 +181,7 @@ test_expect_success '__git_find_repo_path - cwd is a .git directory' '
 test_expect_success '__git_find_repo_path - parent is a .git directory' '
 	echo "$ROOT/.git" >expected &&
 	(
-		cd .git/refs/heads &&
+		cd .git/objects &&
 		__git_find_repo_path &&
 		echo "$__git_repo_path" >"$actual"
 	) &&
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index 8f5c811dd7..c3b89ae783 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -148,7 +148,7 @@ test_expect_success 'prompt - inside .git directory' '
 test_expect_success 'prompt - deep inside .git directory' '
 	printf " (GIT_DIR!)" >expected &&
 	(
-		cd .git/refs/heads &&
+		cd .git/objects &&
 		__git_ps1 >"$actual"
 	) &&
 	test_cmp expected "$actual"
-- 
2.17.0.1181.g093e983b05.dirty
Next: Michael Haggerty
Message 1 of 3 in “t990X: use '.git/objects' as 'deep inside .git' path”
  1. t990X: use '.git/objects' as 'deep inside .git' pathChristian Couder, May 26, 2018
  2. Michael HaggertyMay 27, 2018
  3. Derrick StoleeMay 29, 2018

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.