为什么`git diff`不能与进程替换一起使用? [英] Why does `git diff` not work with process substitution?

查看:124
本文介绍了为什么`git diff`不能与进程替换一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么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`

git diff --no-index相同.

它与普通diff一起使用. cat只是一个简单的例子,可以用一个非平凡的sed表达式代替.

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

解决方法:

$ cat holla | git diff hallo -  # works

但是,如果两个参数都应受到进程替换的影响,则将无法正常工作,如diff和process替换的许多示例中所述.

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

推荐答案

git diff不适用于进程替换,因为

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

这篇关于为什么`git diff`不能与进程替换一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆