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

[bug?] clean: Demonstrate failure when used with paths

From
Rafael Ascensão <rafa.almas@gmail.com>
Date
May 31, 2019, 18:36 UTC
Message-ID
<20190531183651.10067-1-rafa.almas@gmail.com>
---

Yesterday on #git, an user reported the following behaviour of git clean:

    $ git init
    $ mkdir foo
    $ touch a.txt b.txt bar.txt foo/qux.txt
    $ git clean -f bar.txt foo/qux.txt
    Removing bar.txt
Where the behaviour they expected would be:
    $ git clean -f bar.txt foo/qux.txt
    Removing bar.txt
    Removing foo/qux.txt
Sending this "patch" as an excuse to not forget this bug report.
 t/t7300-clean.sh | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
index 7b36954d63..eecbd98906 100755
--- a/t/t7300-clean.sh
+++ b/t/t7300-clean.sh
@@ -92,6 +92,20 @@ test_expect_success 'git clean src/ src/' '
 
 '
 
+test_expect_failure 'git clean a.out docs/manual.tmp' '
+	mkdir -p build docs &&
+	touch a.out b.out docs/manual.txt docs/manual.tmp &&
+	git clean a.out docs/manual.tmp &&
+	test -f Makefile &&
+	test -f README &&
+	test ! -f a.out &&
+	test -f b.out &&
+	test -f docs/manual.txt &&
+	test ! -f docs/manual.tmp &&
+	test -f src/part2.c &&
+	test -f src/part1.c
+'
+
 test_expect_success 'git clean with prefix' '
 
 	mkdir -p build docs src/test &&
-- 
2.21.0
Next: Rafael Ascensão
Message 1 of 3 in “[bug?] clean: Demonstrate failure when used with paths”
  1. Rafael AscensãoMay 31, 2019
  2. Rafael AscensãoJun 3, 2019
  3. Elijah NewrenJun 3, 2019

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.