Re: [PATCH 2/2] Add test for git clean -e.

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 2/2] Add test for git clean -e.

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:49:09

Jared Hance [off-list ref] writes:
quoted hunk
Signed-off-by: Jared Hance <redacted>
---
 t/t7300-clean.sh |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
index 7d8ed68..3a43571 100755
--- a/t/t7300-clean.sh
+++ b/t/t7300-clean.sh
@@ -438,4 +438,20 @@ test_expect_success 'force removal of nested git work tree' '
 	! test -d bar
 '
 
+test_expect_success 'git clean -e' '
+	rm -fr repo &&
+	mkdir repo &&
+	(
+		cd repo &&
+		git init &&
+		touch 1 2 3 known &&
+		git add known &&
+		git clean -f -e 1 -e 2 &&
+		test -e 1 &&
+		test -e 2 &&
+		! (test -e 3) &&
+		test -e known
+	)
+'
This is a good start but it doesn't seem to test possible interactions
with entries in .gitignore file(s) in the working tree.  Do we care?

What should happen when a path "path":

 (1) is marked to be ignored in .gitignore and -e "path" is also given;

 (2) is marked not to be ignored (i.e. "!path") in .gitignore but -e
    "path" is given;

 (3) is marked to be ignored in .gitignore but -e "!path" is given;

 (4) is marked not to be ignored in .gitignore and -e "!path" is also
     given;

 (5) perhaps other combinations like "!path" in a/.gitignore, and -e "a/path"
     from the command line.

What does the code actually do?

Re: [PATCH 2/2] Add test for git clean -e.

From: Jared Hance <hidden>
Date: 2016-06-15 22:49:09

On Tue, Jul 20, 2010 at 01:34:21PM -0700, Junio C Hamano wrote:
This is a good start but it doesn't seem to test possible interactions
with entries in .gitignore file(s) in the working tree.  Do we care?
Honestly, I'm not sure that we do care.
What should happen when a path "path":

 (1) is marked to be ignored in .gitignore and -e "path" is also given;
It is excluded.
 (2) is marked not to be ignored (i.e. "!path") in .gitignore but -e
    "path" is given;
I think it would be good for "!path" to cause -e path to have no
effect because of globbing issues.

Currently, -e works as normal.
 (3) is marked to be ignored in .gitignore but -e "!path" is given;
Again, I'm not sure and am definately open to debate here. Personally,
I think that -e "!path" is completely abusing the use of -e, because
it is using -e to NOT exclude something.

Currently, -e has no effect.
 (4) is marked not to be ignored in .gitignore and -e "!path" is also
     given;
No effect happens. Again, this is abuse of -e in my opinion, as its
goal to allow one to do a clean and save one or two files.
 (5) perhaps other combinations like "!path" in a/.gitignore, and -e "a/path"
     from the command line.
Judging by (2), -e will work as normal.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help