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

[PATCH] grep: simple test for operation in a bare repository

From
René Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Feb 3, 2010, 18:16 UTC
Message-ID
<4B69BD7C.4010608@lsrfire.ath.cx>
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
---
 t/t7002-grep.sh |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/t/t7002-grep.sh b/t/t7002-grep.sh
index bf4d4dc..8cf958d 100755
--- a/t/t7002-grep.sh
+++ b/t/t7002-grep.sh
@@ -45,6 +45,23 @@ test_expect_success 'grep should not segfault with a bad input' '
 	test_must_fail git grep "("
 '
 
+bare_repo=.git/bare_test_repo
+test_expect_success 'setup bare repo' '
+	git clone --bare . $bare_repo
+'
+
+test_expect_success "grep HEAD (t-1), bare repo" '(
+	cd $bare_repo &&
+	echo "HEAD:t/t:1:test" >expected &&
+	git grep -n -e test HEAD >actual &&
+	diff expected actual
+)'
+
+test_expect_success "grep (t-1), bare repo, must fail" '(
+	cd $bare_repo &&
+	test_must_fail git grep -n -e test
+)'
+
 for H in HEAD ''
 do
 	case "$H" in
-- 
1.7.0.rc1
Next: René Scharfe
Message 1 of 7 in “grep: simple test for operation in a bare repository”
  1. grep: simple test for operation in a bare repositoryRené Scharfe, Feb 3, 2010
  2. René ScharfeFeb 3, 2010
  3. René ScharfeFeb 5, 2010
  4. Nguyen Thai Ngoc DuyFeb 5, 2010
  5. René ScharfeFeb 6, 2010
  6. Junio C HamanoFeb 6, 2010
  7. Junio C HamanoFeb 5, 2010

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.