2016-05-11 11 views
1

Ich würde gerne automatisch eine Reihe von Patches testen immer noch sauber gilt für eine (aktualisierte) Code-Basis. Zu diesem Zweck soll ichPatch: im nicht interaktiven Modus

patch -p 1 < path/to/patch0.patch 

für alle Patches patch*.patch, überprüfen Sie den Rückgabecode dieses Befehls und zu speichern, die irgendwo laufen. Leider scheint patch in einigen Fällen interaktiv zu arbeiten. Eine typische Ausgabe erfordern Interaktion würde

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: 

Gibt es eine Möglichkeit patch nicht interaktiv ausgeführt werden? (Vielleicht patch ist nicht das richtige Werkzeug für die Aufgabe hier.)

Antwort

2

Verwenden -f (--force) Option:

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: 

(fragt nach Eingang). Allerdings

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 

Ausfahrten mit Exit-Status ($?) 1:

echo $? 
1 
Verwandte Themen