git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: git@vger.kernel.org
Cc: debian@onerussian.com, Kyle Meyer <kyle@kyleam.com>
Subject: [PATCH 3/4] t3009: test that ls-files -o traverses bogus repo
Date: Thu, 14 Mar 2019 11:02:18 -0400	[thread overview]
Message-ID: <20190314150219.2040-4-kyle@kyleam.com> (raw)
In-Reply-To: <20190314150219.2040-1-kyle@kyleam.com>

When a2d5156c2b (resolve_gitlink_ref: ignore non-repository paths,
2016-01-22) added this test, the purpose was to check the 'ls-files
-o' didn't die() when processing the bogus repository.  The expected
output didn't even need to be adjusted for the addition because the
bogus repository is treated as an empty directory.

Let's add another scenario to test that 'ls-files -o' lists an
untracked file within this directory.  Doing so isn't useful for the
original purpose of the test, but it will be helpful for highlighting
that this traversal does _not_ happen in the non-bogus scenarios that
will be added next.  Rename the original subdirectory to highlight the
difference with the new one.

Signed-off-by: Kyle Meyer <kyle@kyleam.com>
---
 t/t3009-ls-files-others-nonsubmodule.sh | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/t/t3009-ls-files-others-nonsubmodule.sh b/t/t3009-ls-files-others-nonsubmodule.sh
index cc66a4a14d..9ed75928aa 100755
--- a/t/t3009-ls-files-others-nonsubmodule.sh
+++ b/t/t3009-ls-files-others-nonsubmodule.sh
@@ -1,6 +1,14 @@
 #!/bin/sh
 
-test_description='test git ls-files --others with non-submodule repositories'
+test_description='test git ls-files --others with non-submodule repositories
+
+This test runs git ls-files --others with the following working tree:
+
+    repo-bogus-no-files/
+      directory with no files aside from a bogus .git file
+    repo-bogus-untracked-file/
+      directory with a bogus .git file and another untracked file
+'
 
 . ./test-lib.sh
 
@@ -8,12 +16,19 @@ test_expect_success 'setup: expected output' '
 	cat >expected <<-EOF
 	expected
 	output
+	repo-bogus-untracked-file/untracked
 	EOF
 '
 
+test_expect_success 'setup: directories' '
+	mkdir repo-bogus-no-files &&
+	echo foo >repo-bogus-no-files/.git &&
+	mkdir repo-bogus-untracked-file &&
+	echo foo >repo-bogus-untracked-file/.git &&
+	: >repo-bogus-untracked-file/untracked
+'
+
 test_expect_success 'ls-files --others handles non-submodule .git' '
-	mkdir not-a-submodule &&
-	echo foo >not-a-submodule/.git &&
 	git ls-files -o >output &&
 	test_cmp expected output
 '
-- 
2.21.0


  parent reply	other threads:[~2019-03-14 15:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-14 15:02 [PATCH 0/4] dir: Treat a repository without commits as a repository Kyle Meyer
2019-03-14 15:02 ` [PATCH 1/4] submodule: refuse to add repository with no commits Kyle Meyer
2019-03-16 15:40   ` Kyle Meyer
2019-04-02 18:35     ` [PATCH v2 0/4] dir: Treat a repository without commits as a repository Kyle Meyer
2019-04-02 18:35       ` [PATCH v2 1/4] submodule: refuse to add repository with no commits Kyle Meyer
2019-04-04  7:24         ` Junio C Hamano
2019-04-02 18:35       ` [PATCH v2 2/4] t3000: move non-submodule repo test to separate file Kyle Meyer
2019-04-03  7:59         ` Junio C Hamano
2019-04-03 22:21           ` Kyle Meyer
2019-04-02 18:35       ` [PATCH v2 3/4] t3009: test that ls-files -o traverses bogus repo Kyle Meyer
2019-04-02 18:35       ` [PATCH v2 4/4] dir: do not traverse repositories with no commits Kyle Meyer
2019-04-03  8:05         ` Junio C Hamano
2019-04-03 22:25           ` Kyle Meyer
2019-03-14 15:02 ` [PATCH 2/4] t3000: move non-submodule repo test to separate file Kyle Meyer
2019-03-14 15:02 ` Kyle Meyer [this message]
2019-03-14 15:02 ` [PATCH 4/4] dir: do not traverse repositories with no commits Kyle Meyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190314150219.2040-4-kyle@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=debian@onerussian.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).