diff f9f95b10dfcda3981a820a24e7929af6afbebad0 uncommitted --- /tmp/diff100000056765 +++ b/cmd/patch/basic.in @@ -1,0 +1,93 @@ +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +13 +12 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 --- /tmp/diff100000056768 +++ b/cmd/patch/create.expected @@ -1,0 +1,12 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 --- /tmp/diff100000056771 +++ b/cmd/patch/create.patch @@ -1,0 +1,15 @@ +--- /dev/null ++++ create.out +@@ -1,0 +1,12 @@ ++1 ++2 ++3 ++4 ++5 ++6 ++7 ++8 ++9 ++10 ++11 ++12 --- /tmp/diff100000056774 +++ b/cmd/patch/header.expected @@ -1,0 +1,100 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 --- /tmp/diff100000056777 +++ b/cmd/patch/header.in @@ -1,0 +1,93 @@ +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +13 +12 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 --- /tmp/diff100000056780 +++ b/cmd/patch/header.patch @@ -1,0 +1,53 @@ +diff should handle headers just fine, so +this file contains a few lines of header +and footer, with a couple of false starts, +consisting of lines starting with +--- some words +but no immediately following ++++ words +lines + +--- header.in ++++ header.out +@@ -1,3 +1,5 @@ ++1 ++2 + 3 + 4 + 5 +@@ -10,8 +12,8 @@ + 12 + 13 + 14 +-13 +-12 ++15 ++16 + 17 + 18 + 19 +@@ -35,6 +37,8 @@ + 37 + 38 + 39 ++40 ++41 + 42 + 43 + 44 +@@ -80,6 +84,7 @@ + 84 + 85 + 86 ++87 + 88 + 89 + 90 +@@ -91,3 +96,5 @@ + 96 + 97 + 98 ++99 ++100 +and here is the footer that should +also be ignored. --- /tmp/diff100000056783 +++ b/cmd/patch/mkfile @@ -1,0 +1,5 @@ +[2=1] echo fail: $1 $2 + >[2=1] diff -u $1 $2 + exit mismatch + } + status=() +} + +fn checkpatch{ + rm -f $1.out + patch $1.patch + check $1.out $1.expected +} + +checkpatch basic +checkpatch header +checkpatch create + +seq 12 > delete.out +patch delete.patch +test ! -f delete.out + +rm -f multifile^(1 2)^.out +patch multifile.patch +check multifile1.out multifile1.expected +check multifile2.out multifile2.expected + +status=()