# error when git-diff get pipe args

2 messages from 2013-11-05 to 2013-11-05. Participants: chunguang qu, brian m. carlson.
Thread: https://gitlist.dev/t/35280

## chunguang qu, 2013-11-05 00:03

Subject: error when git-diff get pipe args
Message-ID: <CABk77Dj6RUaY9bBShiUJkZp0SdURCNR0SbpS3HFXdmeEAOMYow@mail.gmail.com>
URL: https://gitlist.dev/e/CABk77Dj6RUaY9bBShiUJkZp0SdURCNR0SbpS3HFXdmeEAOMYow%40mail.gmail.com

```
$ cat a
111
fdsf
333
$ cat b
111
222
333
$ git diff a b                             # OK
diff --git a/a b/b
index 768560b..641d574 100644
--- a/a
+++ b/b
@@ -1,3 +1,3 @@
 111
-fdsf
+222
 333
$ git diff <(cat a) <(cat b)          # ERROR: no result print out
diff --git a/dev/fd/63 b/dev/fd/62
index 311e262..554e9f4 120000
--- a/dev/fd/63
+++ b/dev/fd/62
@@ -1 +1 @@
-pipe:[729963]
\ No newline at end of file
+pipe:[729965]
\ No newline at end of file

# compare with diff
$ diff -u a b                            # OK
--- a 2013-11-05 00:18:17.394805923 +0800
+++ b 2013-11-05 00:18:25.546805865 +0800
@@ -1,3 +1,3 @@
 111
-fdsf
+222
 333
$ diff -u <(cat a) <(cat b)         # OK: get result in same case
--- /dev/fd/63 2013-11-05 01:02:59.706787117 +0800
+++ /dev/fd/62 2013-11-05 01:02:59.706787117 +0800
@@ -1,3 +1,3 @@
 111
-fdsf
+222
 333

```

## brian m. carlson, 2013-11-05 00:08

Subject: Re: error when git-diff get pipe args
Message-ID: <20131105000843.GD183446@vauxhall.crustytoothpaste.net>
URL: https://gitlist.dev/e/20131105000843.GD183446%40vauxhall.crustytoothpaste.net
In-Reply-To: <CABk77Dj6RUaY9bBShiUJkZp0SdURCNR0SbpS3HFXdmeEAOMYow@mail.gmail.com>

```
On Tue, Nov 05, 2013 at 08:03:28AM +0800, chunguang qu wrote:
> $ cat a
> 111
> fdsf
> 333
> $ cat b
> 111
> 222
> 333
> $ git diff a b                             # OK
> diff --git a/a b/b
> index 768560b..641d574 100644
> --- a/a
> +++ b/b
> @@ -1,3 +1,3 @@
>  111
> -fdsf
> +222
>  333
> $ git diff <(cat a) <(cat b)          # ERROR: no result print out
> diff --git a/dev/fd/63 b/dev/fd/62
> index 311e262..554e9f4 120000
> --- a/dev/fd/63
> +++ b/dev/fd/62
> @@ -1 +1 @@
> -pipe:[729963]
> \ No newline at end of file
> +pipe:[729965]
> \ No newline at end of file

This is because git diff compares symlinks instead of dereferencing
them, as diff does.  On Linux, /dev/fd is a symlink to /proc/self/fd,
and the items in that directory are all symlinks.

git diff is not generally intended to diff arbitrary files from
arbitrary locations.  For that, you want plain old diff, which works as
you expect.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187

```
