补丁:运行 在非交互模式下
patch: run in non-interactive mode
我想自动测试一组仍然干净利落地适用于(更新的)代码库的补丁。为此,我打算运行
patch -p 1 < path/to/patch0.patch
对于所有补丁 patch*.patch
,检查此命令的 return 代码,并将其存储在某处。不幸的是,patch
在某些情况下似乎可以交互工作。需要交互的典型输出是
can't find file to patch at input line 44
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: foo/docs/faq.html
|===================================================================
|--- foo.orig/docs/faq.html
|+++ foo/docs/faq.html
--------------------------
File to patch:
有没有办法 运行 patch
非交互? (也许 patch
不是完成这里任务的正确工具。)
使用-f
(--force
)选项:
echo a > a
echo b > b
diff -Nu a b > p
rm a b
patch -p 1 < p
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- a 2016-05-11 16:16:24.115481324 +0700
|+++ b 2016-05-11 16:16:24.115481324 +0700
--------------------------
File to patch:
(要求输入)。然而,
patch -f -p 1 < p
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- a 2016-05-11 16:16:24.115481324 +0700
|+++ b 2016-05-11 16:16:24.115481324 +0700
--------------------------
No file to patch. Skipping patch.
1 out of 1 hunk ignored
退出状态为 ($?
) 1:
echo $?
1
我想自动测试一组仍然干净利落地适用于(更新的)代码库的补丁。为此,我打算运行
patch -p 1 < path/to/patch0.patch
对于所有补丁 patch*.patch
,检查此命令的 return 代码,并将其存储在某处。不幸的是,patch
在某些情况下似乎可以交互工作。需要交互的典型输出是
can't find file to patch at input line 44
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: foo/docs/faq.html
|===================================================================
|--- foo.orig/docs/faq.html
|+++ foo/docs/faq.html
--------------------------
File to patch:
有没有办法 运行 patch
非交互? (也许 patch
不是完成这里任务的正确工具。)
使用-f
(--force
)选项:
echo a > a
echo b > b
diff -Nu a b > p
rm a b
patch -p 1 < p
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- a 2016-05-11 16:16:24.115481324 +0700
|+++ b 2016-05-11 16:16:24.115481324 +0700
--------------------------
File to patch:
(要求输入)。然而,
patch -f -p 1 < p
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- a 2016-05-11 16:16:24.115481324 +0700
|+++ b 2016-05-11 16:16:24.115481324 +0700
--------------------------
No file to patch. Skipping patch.
1 out of 1 hunk ignored
退出状态为 ($?
) 1:
echo $?
1