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

3 messages from 2019-05-31 to 2019-06-03. Participants: Rafael Ascensão, Elijah Newren.
Thread: https://gitlist.dev/t/51213

## Rafael Ascensão, 2019-05-31 18:36

Subject: [bug?] clean: Demonstrate failure when used with paths
Message-ID: <20190531183651.10067-1-rafa.almas@gmail.com>
URL: https://gitlist.dev/e/20190531183651.10067-1-rafa.almas%40gmail.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


```

## Rafael Ascensão, 2019-06-03 19:57

Subject: Re: [bug?] clean: Demonstrate failure when used with paths
Message-ID: <CACUQV59ZQ=WLXa4iDw3nSJWnZpiqAYLOuoHKsNWj48uC=+k5KQ@mail.gmail.com>
URL: https://gitlist.dev/e/CACUQV59ZQ%3DWLXa4iDw3nSJWnZpiqAYLOuoHKsNWj48uC%3D%2Bk5KQ%40mail.gmail.com
In-Reply-To: <20190531183651.10067-1-rafa.almas@gmail.com>

```
I missed this RFC series which fixes this and others issues:
https://public-inbox.org/git/20180405173446.32372-1-newren@gmail.com

Cheers,
Rafael Ascensão

```

## Elijah Newren, 2019-06-03 20:32

Subject: Re: [bug?] clean: Demonstrate failure when used with paths
Message-ID: <CABPp-BFfYFj232cHd6_NTkEg1n8AOQ4Abm7ZrnLPWHJEDzUPsg@mail.gmail.com>
URL: https://gitlist.dev/e/CABPp-BFfYFj232cHd6_NTkEg1n8AOQ4Abm7ZrnLPWHJEDzUPsg%40mail.gmail.com
In-Reply-To: <CACUQV59ZQ=WLXa4iDw3nSJWnZpiqAYLOuoHKsNWj48uC=+k5KQ@mail.gmail.com>

```
On Mon, Jun 3, 2019 at 12:58 PM Rafael Ascensão <rafa.almas@gmail.com> wrote:
>
> I missed this RFC series which fixes this and others issues:
> https://public-inbox.org/git/20180405173446.32372-1-newren@gmail.com
>
> Cheers,
> Rafael Ascensão

Yeah, I've had cleaning that patch series up on my TODO list for quite
some time.

My vague recollection was that Peff pointed out a few things to clean
up in my patches, and also highlighted a few extra adjacent issues in
the surrounding underlying code...and when I started looking into
fixing the additional stuff it was slightly more complex and ugly (and
for some reason I didn't decide to just fix up and submit what I had
but was trying to fix everything in the area).

Also, briefly looking back at the cover letter and thread overview it
looks like no one ever attempted to shed light on the question I asked
in my RFC about what correct behavior was for one special case (i.e.
whether patches 5 & 6 of that series should be kept or whether they
should be dropped and patch 7 should be squashed into earlier
patches).  Anyone have thoughts on that?

Elijah

```
