Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does `git diff` not work with process substitution?

Tags:

git

bash

git-diff

Why does git diff not work with process substitution?

$ echo hallo > hallo $ echo holla > holla  $ git diff hallo holla  # works  $ git diff hallo <(cat holla)  # works not  diff --git a/hallo b/hallo deleted file mode 100644 index 4cf5aa5..0000000 --- a/hallo +++ /dev/null @@ -1 +0,0 @@ -hallo diff --git a/dev/fd/63 b/dev/fd/63 new file mode 120000 index 0000000..864a6ca` 

Same with git diff --no-index.

It works with plain diff. cat is only a trivial example, can be replaced by a non-trivial sed expression.

Workaround:

$ cat holla | git diff hallo -  # works 

But it will not work if both arguments should be affected by process substitution, like described in many examples for diff and process substitution.

like image 869
user6928 Avatar asked Mar 28 '14 07:03

user6928


People also ask

Why is git diff not showing?

In answer to the original question, git diff isn't showing anything because you have a brand new directory, with a newly added file, but there are zero changes in the file for git diff to show. git status is showing that you added a new file, but git diff is for showing changes within files.

How does git diff work internally?

Diffing is a function that takes two input data sets and outputs the changes between them. git diff is a multi-use Git command that when executed runs a diff function on Git data sources. These data sources can be commits, branches, files and more.

What does ++ mean in git diff?

When viewing a combined diff, if the two files you're comparing have a line that's different from what they were merged into, you will see the ++ to represent: one line that was added does not appear in either file1 or file2.

Can you git diff a specific file?

The git diff command returns a list of all the changes in all the files between our last commit and our current repository. If you want to retrieve the changes made to a specific file in a repository, you can specify that file as a third parameter.


1 Answers

git diff does not work with process substitution because a patch that added handling of process substitution was ignored.

like image 196
marcin Avatar answered Oct 05 '22 01:10

marcin