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.
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.
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.
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.
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.
git diff
does not work with process substitution because a patch that added handling of process substitution was ignored.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With