# diff-filter=R can't identify renaming if not done directly

2 messages from 2020-12-04 to 2020-12-04. Participants: Sofia Syrianidou, Junio C Hamano.
Thread: https://gitlist.dev/t/54761

## Sofia Syrianidou, 2020-12-04 14:37

Subject: diff-filter=R can't identify renaming if not done directly
Message-ID: <19eb8038-20d6-385f-50e5-26c7a0bd8e90@suse.com>
URL: https://gitlist.dev/e/19eb8038-20d6-385f-50e5-26c7a0bd8e90%40suse.com

```
Hello, quick question about using diff-filter in linux. In the scenario
that in my repository, I first copy file1 to file2, then move file2 to
file3 and delete file1, "git diff" returns


diff --git a/file1 b/file3

similarity index 100%

rename from file 1

rename to file3


  but running "git diff --diff-filter=r" doesn't return anything. Only
flag T will return the change. Can this be considered as a bug?


```

## Junio C Hamano, 2020-12-04 20:07

Subject: Re: diff-filter=R can't identify renaming if not done directly
Message-ID: <xmqqlfede3o8.fsf@gitster.c.googlers.com>
URL: https://gitlist.dev/e/xmqqlfede3o8.fsf%40gitster.c.googlers.com
In-Reply-To: <19eb8038-20d6-385f-50e5-26c7a0bd8e90@suse.com>

```
Sofia Syrianidou <sofia.syrianidou@suse.com> writes:

> Hello, quick question about using diff-filter in linux. In the scenario
> that in my repository, I first copy file1 to file2, then move file2 to
> file3 and delete file1, "git diff" returns
>
>
> diff --git a/file1 b/file3
>
> similarity index 100%
>
> rename from file 1
>
> rename to file3
>
>
>   but running "git diff --diff-filter=r" doesn't return anything. Only
> flag T will return the change. Can this be considered as a bug?

"git diff --diff-filter=r" and "git diff --diff-filter=R" have
totally opposite meanings.  I expect nothing to be shown if all your
changes are renames and you ask to exclude all the renamed filepairs
from the output with "--diff-filter=r".  In other words, this seems
to be working as intended.

Thanks.


```
