# Git diff --no-index --no-prefix output loses leading slash in paths

3 messages from 2018-06-18 to 2018-06-18. Participants: George King, Duy Nguyen.
Thread: https://gitlist.dev/t/48731

## George King, 2018-06-18 14:33

Subject: Git diff --no-index --no-prefix output loses leading slash in paths
Message-ID: <DFDB0568-9543-4135-A56D-821D4244DC8A@gmail.com>
URL: https://gitlist.dev/e/DFDB0568-9543-4135-A56D-821D4244DC8A%40gmail.com

```
As of 2.17.1, `git diff --no-index --no-prefix relative/path /absolute/path` produces the following:

diff --git relative/path absolute/path
index XXXXXXX..YYYYYYY ZZZZZZ
--- relative/path
+++ absolute/path

The leading slash on `absolute/path` is lost. This is unfortunate; my use case is a diff highlighter that parses and reformats paths so that code editors can autodetect them and link to the files. 

Would the maintainers please consider fixing the output to preserve absolute paths?

Thank you,
George King


```

## Duy Nguyen, 2018-06-18 14:59

Subject: Re: Git diff --no-index --no-prefix output loses leading slash in paths
Message-ID: <CACsJy8Cgm6gryO=X2GmztynbkkEEV=nz_J+QZG-93fS7D4eDRQ@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8Cgm6gryO%3DX2GmztynbkkEEV%3Dnz_J%2BQZG-93fS7D4eDRQ%40mail.gmail.com
In-Reply-To: <DFDB0568-9543-4135-A56D-821D4244DC8A@gmail.com>

```
On Mon, Jun 18, 2018 at 4:36 PM George King <george.w.king@gmail.com> wrote:
>
> As of 2.17.1, `git diff --no-index --no-prefix relative/path /absolute/path` produces the following:

I checked as far back as v1.4.0 and git behaved the same way too. What
version did it work for you? Or is this not a regression, rather a
feature request?

> diff --git relative/path absolute/path
> index XXXXXXX..YYYYYYY ZZZZZZ
> --- relative/path
> +++ absolute/path
>
> The leading slash on `absolute/path` is lost. This is unfortunate; my use case is a diff highlighter that parses and reformats paths so that code editors can autodetect them and link to the files.
>
> Would the maintainers please consider fixing the output to preserve absolute paths?
>
> Thank you,
> George King
>
-- 
Duy

```

## George King, 2018-06-18 15:01

Subject: Re: Git diff --no-index --no-prefix output loses leading slash in paths
Message-ID: <9852F27B-0FB8-4A7E-97C1-52B5D0D9377E@gmail.com>
URL: https://gitlist.dev/e/9852F27B-0FB8-4A7E-97C1-52B5D0D9377E%40gmail.com
In-Reply-To: <CACsJy8Cgm6gryO=X2GmztynbkkEEV=nz_J+QZG-93fS7D4eDRQ@mail.gmail.com>

```
This is a feature request; sorry for the confusion. My guess is that it's a corner case that was not considered due to the default prefixing.


> On Jun 18, 2018, at 10:59 AM, Duy Nguyen <pclouds@gmail.com> wrote:
> 
> On Mon, Jun 18, 2018 at 4:36 PM George King <george.w.king@gmail.com> wrote:
>> 
>> As of 2.17.1, `git diff --no-index --no-prefix relative/path /absolute/path` produces the following:
> 
> I checked as far back as v1.4.0 and git behaved the same way too. What
> version did it work for you? Or is this not a regression, rather a
> feature request?
> 
>> diff --git relative/path absolute/path
>> index XXXXXXX..YYYYYYY ZZZZZZ
>> --- relative/path
>> +++ absolute/path
>> 
>> The leading slash on `absolute/path` is lost. This is unfortunate; my use case is a diff highlighter that parses and reformats paths so that code editors can autodetect them and link to the files.
>> 
>> Would the maintainers please consider fixing the output to preserve absolute paths?
>> 
>> Thank you,
>> George King
>> 
> -- 
> Duy


```
