1 /* The original file contents */ 2 3 #define FILE_ORIGINAL \ 4 "hey!\n" \ 5 "this is some context!\n" \ 6 "around some lines\n" \ 7 "that will change\n" \ 8 "yes it is!\n" \ 9 "(this line is changed)\n" \ 10 "and this\n" \ 11 "is additional context\n" \ 12 "below it!\n" 13 14 /* A change in the middle of the file (and the resultant patch) */ 15 16 #define FILE_CHANGE_MIDDLE \ 17 "hey!\n" \ 18 "this is some context!\n" \ 19 "around some lines\n" \ 20 "that will change\n" \ 21 "yes it is!\n" \ 22 "(THIS line is changed!)\n" \ 23 "and this\n" \ 24 "is additional context\n" \ 25 "below it!\n" 26 27 #define PATCH_ORIGINAL_TO_CHANGE_MIDDLE \ 28 "diff --git a/file.txt b/file.txt\n" \ 29 "index 9432026..cd8fd12 100644\n" \ 30 "--- a/file.txt\n" \ 31 "+++ b/file.txt\n" \ 32 "@@ -3,7 +3,7 @@ this is some context!\n" \ 33 " around some lines\n" \ 34 " that will change\n" \ 35 " yes it is!\n" \ 36 "-(this line is changed)\n" \ 37 "+(THIS line is changed!)\n" \ 38 " and this\n" \ 39 " is additional context\n" \ 40 " below it!\n" 41 42 #define PATCH_ORIGINAL_TO_CHANGE_MIDDLE_NOCONTEXT \ 43 "diff --git a/file.txt b/file.txt\n" \ 44 "index 9432026..cd8fd12 100644\n" \ 45 "--- a/file.txt\n" \ 46 "+++ b/file.txt\n" \ 47 "@@ -6 +6 @@ yes it is!\n" \ 48 "-(this line is changed)\n" \ 49 "+(THIS line is changed!)\n" 50 51 /* A change of the first line (and the resultant patch) */ 52 53 #define FILE_CHANGE_FIRSTLINE \ 54 "hey, change in head!\n" \ 55 "this is some context!\n" \ 56 "around some lines\n" \ 57 "that will change\n" \ 58 "yes it is!\n" \ 59 "(this line is changed)\n" \ 60 "and this\n" \ 61 "is additional context\n" \ 62 "below it!\n" 63 64 #define PATCH_ORIGINAL_TO_CHANGE_FIRSTLINE \ 65 "diff --git a/file.txt b/file.txt\n" \ 66 "index 9432026..c81df1d 100644\n" \ 67 "--- a/file.txt\n" \ 68 "+++ b/file.txt\n" \ 69 "@@ -1,4 +1,4 @@\n" \ 70 "-hey!\n" \ 71 "+hey, change in head!\n" \ 72 " this is some context!\n" \ 73 " around some lines\n" \ 74 " that will change\n" 75 76 /* A change of the last line (and the resultant patch) */ 77 78 #define FILE_CHANGE_LASTLINE \ 79 "hey!\n" \ 80 "this is some context!\n" \ 81 "around some lines\n" \ 82 "that will change\n" \ 83 "yes it is!\n" \ 84 "(this line is changed)\n" \ 85 "and this\n" \ 86 "is additional context\n" \ 87 "change to the last line.\n" 88 89 #define PATCH_ORIGINAL_TO_CHANGE_LASTLINE \ 90 "diff --git a/file.txt b/file.txt\n" \ 91 "index 9432026..f70db1c 100644\n" \ 92 "--- a/file.txt\n" \ 93 "+++ b/file.txt\n" \ 94 "@@ -6,4 +6,4 @@ yes it is!\n" \ 95 " (this line is changed)\n" \ 96 " and this\n" \ 97 " is additional context\n" \ 98 "-below it!\n" \ 99 "+change to the last line.\n" 100 101 /* A change of the middle where we remove many lines */ 102 103 #define FILE_CHANGE_MIDDLE_SHRINK \ 104 "hey!\n" \ 105 "i've changed a lot, but left the line\n" \ 106 "below it!\n" 107 108 #define PATCH_ORIGINAL_TO_CHANGE_MIDDLE_SHRINK \ 109 "diff --git a/file.txt b/file.txt\n" \ 110 "index 9432026..629cd35 100644\n" \ 111 "--- a/file.txt\n" \ 112 "+++ b/file.txt\n" \ 113 "@@ -1,9 +1,3 @@\n" \ 114 " hey!\n" \ 115 "-this is some context!\n" \ 116 "-around some lines\n" \ 117 "-that will change\n" \ 118 "-yes it is!\n" \ 119 "-(this line is changed)\n" \ 120 "-and this\n" \ 121 "-is additional context\n" \ 122 "+i've changed a lot, but left the line\n" \ 123 " below it!\n" 124 125 #define PATCH_ORIGINAL_TO_MIDDLE_SHRINK_NOCONTEXT \ 126 "diff --git a/file.txt b/file.txt\n" \ 127 "index 9432026..629cd35 100644\n" \ 128 "--- a/file.txt\n" \ 129 "+++ b/file.txt\n" \ 130 "@@ -2,7 +2 @@ hey!\n" \ 131 "-this is some context!\n" \ 132 "-around some lines\n" \ 133 "-that will change\n" \ 134 "-yes it is!\n" \ 135 "-(this line is changed)\n" \ 136 "-and this\n" \ 137 "-is additional context\n" \ 138 "+i've changed a lot, but left the line\n" 139 140 /* A change to the middle where we grow many lines */ 141 142 #define FILE_CHANGE_MIDDLE_GROW \ 143 "hey!\n" \ 144 "this is some context!\n" \ 145 "around some lines\n" \ 146 "that will change\n" \ 147 "yes it is!\n" \ 148 "this line is changed\n" \ 149 "and this line is added\n" \ 150 "so is this\n" \ 151 "(this too)\n" \ 152 "whee...\n" \ 153 "and this\n" \ 154 "is additional context\n" \ 155 "below it!\n" 156 157 #define PATCH_ORIGINAL_TO_CHANGE_MIDDLE_GROW \ 158 "diff --git a/file.txt b/file.txt\n" \ 159 "index 9432026..207ebca 100644\n" \ 160 "--- a/file.txt\n" \ 161 "+++ b/file.txt\n" \ 162 "@@ -3,7 +3,11 @@ this is some context!\n" \ 163 " around some lines\n" \ 164 " that will change\n" \ 165 " yes it is!\n" \ 166 "-(this line is changed)\n" \ 167 "+this line is changed\n" \ 168 "+and this line is added\n" \ 169 "+so is this\n" \ 170 "+(this too)\n" \ 171 "+whee...\n" \ 172 " and this\n" \ 173 " is additional context\n" \ 174 " below it!\n" 175 176 177 #define PATCH_ORIGINAL_TO_MIDDLE_GROW_NOCONTEXT \ 178 "diff --git a/file.txt b/file.txt\n" \ 179 "index 9432026..207ebca 100644\n" \ 180 "--- a/file.txt\n" \ 181 "+++ b/file.txt\n" \ 182 "@@ -6 +6,5 @@ yes it is!\n" \ 183 "-(this line is changed)\n" \ 184 "+this line is changed\n" \ 185 "+and this line is added\n" \ 186 "+so is this\n" \ 187 "+(this too)\n" \ 188 "+whee...\n" 189 190 /* An insertion at the beginning of the file (and the resultant patch) */ 191 192 #define FILE_PREPEND \ 193 "insert at front\n" \ 194 "hey!\n" \ 195 "this is some context!\n" \ 196 "around some lines\n" \ 197 "that will change\n" \ 198 "yes it is!\n" \ 199 "(this line is changed)\n" \ 200 "and this\n" \ 201 "is additional context\n" \ 202 "below it!\n" 203 204 #define PATCH_ORIGINAL_TO_PREPEND \ 205 "diff --git a/file.txt b/file.txt\n" \ 206 "index 9432026..0f39b9a 100644\n" \ 207 "--- a/file.txt\n" \ 208 "+++ b/file.txt\n" \ 209 "@@ -1,3 +1,4 @@\n" \ 210 "+insert at front\n" \ 211 " hey!\n" \ 212 " this is some context!\n" \ 213 " around some lines\n" 214 215 #define PATCH_ORIGINAL_TO_PREPEND_NOCONTEXT \ 216 "diff --git a/file.txt b/file.txt\n" \ 217 "index 9432026..0f39b9a 100644\n" \ 218 "--- a/file.txt\n" \ 219 "+++ b/file.txt\n" \ 220 "@@ -0,0 +1 @@\n" \ 221 "+insert at front\n" 222 223 /* An insertion at the beginning of the file and change in the middle */ 224 225 #define FILE_PREPEND_AND_CHANGE \ 226 "insert at front\n" \ 227 "hey!\n" \ 228 "this is some context!\n" \ 229 "around some lines\n" \ 230 "that will change\n" \ 231 "yes it is!\n" \ 232 "(THIS line is changed!)\n" \ 233 "and this\n" \ 234 "is additional context\n" \ 235 "below it!\n" 236 237 #define PATCH_ORIGINAL_TO_PREPEND_AND_CHANGE \ 238 "diff --git a/file.txt b/file.txt\n" \ 239 "index 9432026..f73c8bb 100644\n" \ 240 "--- a/file.txt\n" \ 241 "+++ b/file.txt\n" \ 242 "@@ -1,9 +1,10 @@\n" \ 243 "+insert at front\n" \ 244 " hey!\n" \ 245 " this is some context!\n" \ 246 " around some lines\n" \ 247 " that will change\n" \ 248 " yes it is!\n" \ 249 "-(this line is changed)\n" \ 250 "+(THIS line is changed!)\n" \ 251 " and this\n" \ 252 " is additional context\n" \ 253 " below it!\n" 254 255 #define PATCH_ORIGINAL_TO_PREPEND_AND_CHANGE_NOCONTEXT \ 256 "diff --git a/file.txt b/file.txt\n" \ 257 "index 9432026..f73c8bb 100644\n" \ 258 "--- a/file.txt\n" \ 259 "+++ b/file.txt\n" \ 260 "@@ -0,0 +1 @@\n" \ 261 "+insert at front\n" \ 262 "@@ -6 +7 @@ yes it is!\n" \ 263 "-(this line is changed)\n" \ 264 "+(THIS line is changed!)\n" 265 266 /* A change in the middle and a deletion of the newline at the end of the file */ 267 268 #define FILE_CHANGE_MIDDLE_AND_LASTLINE \ 269 "hey!\n" \ 270 "this is some context!\n" \ 271 "around some lines\n" \ 272 "that will change\n" \ 273 "yes it is!\n" \ 274 "(THIS line is changed!)\n" \ 275 "and this\n" \ 276 "is additional context\n" \ 277 "BELOW it! - (THIS line is changed!)" 278 279 #define PATCH_ORIGINAL_TO_CHANGE_MIDDLE_AND_LASTLINE_NOCONTEXT \ 280 "diff --git a/file.txt b/file.txt\n" \ 281 "index 9432026..e05d36c 100644\n" \ 282 "--- a/file.txt\n" \ 283 "+++ b/file.txt\n" \ 284 "@@ -6 +6 @@ yes it is!\n" \ 285 "-(this line is changed)\n" \ 286 "+(THIS line is changed!)\n" \ 287 "@@ -9 +9 @@ is additional context\n" \ 288 "-below it!\n" \ 289 "+BELOW it! - (THIS line is changed!)\n" \ 290 "\\ No newline at end of file\n" 291 292 /* A deletion at the beginning of the file and a change in the middle */ 293 294 #define FILE_DELETE_AND_CHANGE \ 295 "this is some context!\n" \ 296 "around some lines\n" \ 297 "that will change\n" \ 298 "yes it is!\n" \ 299 "(THIS line is changed!)\n" \ 300 "and this\n" \ 301 "is additional context\n" \ 302 "below it!\n" 303 304 #define PATCH_ORIGINAL_TO_DELETE_AND_CHANGE \ 305 "diff --git a/file.txt b/file.txt\n" \ 306 "index 9432026..1e2dfa6 100644\n" \ 307 "--- a/file.txt\n" \ 308 "+++ b/file.txt\n" \ 309 "@@ -1,9 +1,8 @@\n" \ 310 "-hey!\n" \ 311 " this is some context!\n" \ 312 " around some lines\n" \ 313 " that will change\n" \ 314 " yes it is!\n" \ 315 "-(this line is changed)\n" \ 316 "+(THIS line is changed!)\n" \ 317 " and this\n" \ 318 " is additional context\n" \ 319 " below it!\n" 320 321 #define PATCH_ORIGINAL_TO_DELETE_AND_CHANGE_NOCONTEXT \ 322 "diff --git a/file.txt b/file.txt\n" \ 323 "index 9432026..1e2dfa6 100644\n" \ 324 "--- a/file.txt\n" \ 325 "+++ b/file.txt\n" \ 326 "@@ -1 +0,0 @@\n" \ 327 "-hey!\n" \ 328 "@@ -6 +5 @@ yes it is!\n" \ 329 "-(this line is changed)\n" \ 330 "+(THIS line is changed!)\n" 331 332 /* A deletion at the beginning of the file */ 333 334 #define FILE_DELETE_FIRSTLINE \ 335 "this is some context!\n" \ 336 "around some lines\n" \ 337 "that will change\n" \ 338 "yes it is!\n" \ 339 "(this line is changed)\n" \ 340 "and this\n" \ 341 "is additional context\n" \ 342 "below it!\n" 343 344 #define PATCH_ORIGINAL_TO_DELETE_FIRSTLINE \ 345 "diff --git a/file.txt b/file.txt\n" \ 346 "index 9432026..f31fa13 100644\n" \ 347 "--- a/file.txt\n" \ 348 "+++ b/file.txt\n" \ 349 "@@ -1,4 +1,3 @@\n" \ 350 "-hey!\n" \ 351 " this is some context!\n" \ 352 " around some lines\n" \ 353 " that will change\n" 354 355 /* An insertion at the end of the file (and the resultant patch) */ 356 357 #define FILE_APPEND \ 358 "hey!\n" \ 359 "this is some context!\n" \ 360 "around some lines\n" \ 361 "that will change\n" \ 362 "yes it is!\n" \ 363 "(this line is changed)\n" \ 364 "and this\n" \ 365 "is additional context\n" \ 366 "below it!\n" \ 367 "insert at end\n" 368 369 #define PATCH_ORIGINAL_TO_APPEND \ 370 "diff --git a/file.txt b/file.txt\n" \ 371 "index 9432026..72788bb 100644\n" \ 372 "--- a/file.txt\n" \ 373 "+++ b/file.txt\n" \ 374 "@@ -7,3 +7,4 @@ yes it is!\n" \ 375 " and this\n" \ 376 " is additional context\n" \ 377 " below it!\n" \ 378 "+insert at end\n" 379 380 #define PATCH_ORIGINAL_TO_APPEND_NOCONTEXT \ 381 "diff --git a/file.txt b/file.txt\n" \ 382 "index 9432026..72788bb 100644\n" \ 383 "--- a/file.txt\n" \ 384 "+++ b/file.txt\n" \ 385 "@@ -9,0 +10 @@ below it!\n" \ 386 "+insert at end\n" 387 388 #define PATCH_DELETED_FILE_2_HUNKS \ 389 "diff --git a/a b/a\n" \ 390 "index 7f129fd..af431f2 100644\n" \ 391 "--- a/a\n" \ 392 "+++ b/a\n" \ 393 "@@ -1 +1 @@\n" \ 394 "-a contents 2\n" \ 395 "+a contents\n" \ 396 "diff --git a/c/d b/c/d\n" \ 397 "deleted file mode 100644\n" \ 398 "index 297efb8..0000000\n" \ 399 "--- a/c/d\n" \ 400 "+++ /dev/null\n" \ 401 "@@ -1 +0,0 @@\n" \ 402 "-c/d contents\n" 403 404 #define PATCH_DELETED_FILE_2_HUNKS_SHUFFLED \ 405 "diff --git a/c/d b/c/d\n" \ 406 "deleted file mode 100644\n" \ 407 "index 297efb8..0000000\n" \ 408 "--- a/c/d\n" \ 409 "+++ /dev/null\n" \ 410 "@@ -1 +0,0 @@\n" \ 411 "-c/d contents\n" \ 412 "diff --git a/a b/a\n" \ 413 "index 7f129fd..af431f2 100644\n" \ 414 "--- a/a\n" \ 415 "+++ b/a\n" \ 416 "@@ -1 +1 @@\n" \ 417 "-a contents 2\n" \ 418 "+a contents\n" 419 420 #define PATCH_SIMPLE_COMMIT \ 421 "commit 15e119375018fba121cf58e02a9f17fe22df0df8\n" \ 422 "Author: Edward Thomson <ethomson@edwardthomson.com>\n" \ 423 "Date: Wed Jun 14 13:31:20 2017 +0200\n" \ 424 "\n" \ 425 " CHANGELOG: document git_filter_init and GIT_FILTER_INIT\n" \ 426 "\n" \ 427 "diff --git a/CHANGELOG.md b/CHANGELOG.md\n" \ 428 "index 1b9e0c90a..24ecba426 100644\n" \ 429 "--- a/CHANGELOG.md\n" \ 430 "+++ b/CHANGELOG.md\n" \ 431 "@@ -96,6 +96,9 @@ v0.26\n" \ 432 " * `git_transport_smart_proxy_options()' enables you to get the proxy options for\n" \ 433 " smart transports.\n" \ 434 "\n" \ 435 "+* The `GIT_FILTER_INIT` macro and the `git_filter_init` function are provided\n" \ 436 "+ to initialize a `git_filter` structure.\n" \ 437 "+\n" \ 438 " ### Breaking API changes\n" \ 439 "\n" \ 440 " * `clone_checkout_strategy` has been removed from\n" 441 442 #define PATCH_MULTIPLE_HUNKS \ 443 "diff --git a/x b/x\n" \ 444 "index 0719398..fa0350c 100644\n" \ 445 "--- a/x\n" \ 446 "+++ b/x\n" \ 447 "@@ -1,5 +1,4 @@\n" \ 448 " 1\n" \ 449 "-2\n" \ 450 " 3\n" \ 451 " 4\n" \ 452 " 5\n" \ 453 "@@ -7,3 +6,4 @@\n" \ 454 " 7\n" \ 455 " 8\n" \ 456 " 9\n" \ 457 "+10\n" 458 459 #define PATCH_MULTIPLE_FILES \ 460 "diff --git a/x b/x\n" \ 461 "index 8a1218a..7059ba5 100644\n" \ 462 "--- a/x\n" \ 463 "+++ b/x\n" \ 464 "@@ -1,5 +1,4 @@\n" \ 465 " 1\n" \ 466 " 2\n" \ 467 "-3\n" \ 468 " 4\n" \ 469 " 5\n" \ 470 "diff --git a/y b/y\n" \ 471 "index e006065..9405325 100644\n" \ 472 "--- a/y\n" \ 473 "+++ b/y\n" \ 474 "@@ -1,4 +1,5 @@\n" \ 475 " a\n" \ 476 " b\n" \ 477 "+c\n" \ 478 " d\n" \ 479 " e\n" 480 481 #define FILE_PREPEND_AND_APPEND \ 482 "first and\n" \ 483 "this is some context!\n" \ 484 "around some lines\n" \ 485 "that will change\n" \ 486 "yes it is!\n" \ 487 "(this line is changed)\n" \ 488 "and this\n" \ 489 "is additional context\n" \ 490 "last lines\n" 491 492 #define PATCH_ORIGINAL_TO_PREPEND_AND_APPEND \ 493 "diff --git a/file.txt b/file.txt\n" \ 494 "index 9432026..f282430 100644\n" \ 495 "--- a/file.txt\n" \ 496 "+++ b/file.txt\n" \ 497 "@@ -1,4 +1,4 @@\n" \ 498 "-hey!\n" \ 499 "+first and\n" \ 500 " this is some context!\n" \ 501 " around some lines\n" \ 502 " that will change\n" \ 503 "@@ -6,4 +6,4 @@ yes it is!\n" \ 504 " (this line is changed)\n" \ 505 " and this\n" \ 506 " is additional context\n" \ 507 "-below it!\n" \ 508 "+last lines\n" 509 510 #define PATCH_ORIGINAL_TO_EMPTY_FILE \ 511 "diff --git a/file.txt b/file.txt\n" \ 512 "index 9432026..e69de29 100644\n" \ 513 "--- a/file.txt\n" \ 514 "+++ b/file.txt\n" \ 515 "@@ -1,9 +0,0 @@\n" \ 516 "-hey!\n" \ 517 "-this is some context!\n" \ 518 "-around some lines\n" \ 519 "-that will change\n" \ 520 "-yes it is!\n" \ 521 "-(this line is changed)\n" \ 522 "-and this\n" \ 523 "-is additional context\n" \ 524 "-below it!\n" 525 526 #define PATCH_EMPTY_FILE_TO_ORIGINAL \ 527 "diff --git a/file.txt b/file.txt\n" \ 528 "index e69de29..9432026 100644\n" \ 529 "--- a/file.txt\n" \ 530 "+++ b/file.txt\n" \ 531 "@@ -0,0 +1,9 @@\n" \ 532 "+hey!\n" \ 533 "+this is some context!\n" \ 534 "+around some lines\n" \ 535 "+that will change\n" \ 536 "+yes it is!\n" \ 537 "+(this line is changed)\n" \ 538 "+and this\n" \ 539 "+is additional context\n" \ 540 "+below it!\n" 541 542 #define PATCH_ADD_ORIGINAL \ 543 "diff --git a/file.txt b/file.txt\n" \ 544 "new file mode 100644\n" \ 545 "index 0000000..9432026\n" \ 546 "--- /dev/null\n" \ 547 "+++ b/file.txt\n" \ 548 "@@ -0,0 +1,9 @@\n" \ 549 "+hey!\n" \ 550 "+this is some context!\n" \ 551 "+around some lines\n" \ 552 "+that will change\n" \ 553 "+yes it is!\n" \ 554 "+(this line is changed)\n" \ 555 "+and this\n" \ 556 "+is additional context\n" \ 557 "+below it!\n" 558 559 #define PATCH_DELETE_ORIGINAL \ 560 "diff --git a/file.txt b/file.txt\n" \ 561 "deleted file mode 100644\n" \ 562 "index 9432026..0000000\n" \ 563 "--- a/file.txt\n" \ 564 "+++ /dev/null\n" \ 565 "@@ -1,9 +0,0 @@\n" \ 566 "-hey!\n" \ 567 "-this is some context!\n" \ 568 "-around some lines\n" \ 569 "-that will change\n" \ 570 "-yes it is!\n" \ 571 "-(this line is changed)\n" \ 572 "-and this\n" \ 573 "-is additional context\n" \ 574 "-below it!\n" 575 576 #define PATCH_RENAME_EXACT \ 577 "diff --git a/file.txt b/newfile.txt\n" \ 578 "similarity index 100%\n" \ 579 "rename from file.txt\n" \ 580 "rename to newfile.txt\n" 581 582 #define PATCH_RENAME_EXACT_WITH_MODE \ 583 "diff --git a/RENAMED.md b/README.md\n" \ 584 "old mode 100644\n" \ 585 "new mode 100755\n" \ 586 "similarity index 100%\n" \ 587 "rename from RENAMED.md\n" \ 588 "rename to README.md\n" 589 590 #define PATCH_RENAME_SIMILAR \ 591 "diff --git a/file.txt b/newfile.txt\n" \ 592 "similarity index 77%\n" \ 593 "rename from file.txt\n" \ 594 "rename to newfile.txt\n" \ 595 "index 9432026..cd8fd12 100644\n" \ 596 "--- a/file.txt\n" \ 597 "+++ b/newfile.txt\n" \ 598 "@@ -3,7 +3,7 @@ this is some context!\n" \ 599 " around some lines\n" \ 600 " that will change\n" \ 601 " yes it is!\n" \ 602 "-(this line is changed)\n" \ 603 "+(THIS line is changed!)\n" \ 604 " and this\n" \ 605 " is additional context\n" \ 606 " below it!\n" 607 608 #define PATCH_RENAME_EXACT_QUOTEDNAME \ 609 "diff --git a/file.txt \"b/foo\\\"bar.txt\"\n" \ 610 "similarity index 100%\n" \ 611 "rename from file.txt\n" \ 612 "rename to \"foo\\\"bar.txt\"\n" 613 614 #define PATCH_RENAME_SIMILAR_QUOTEDNAME \ 615 "diff --git a/file.txt \"b/foo\\\"bar.txt\"\n" \ 616 "similarity index 77%\n" \ 617 "rename from file.txt\n" \ 618 "rename to \"foo\\\"bar.txt\"\n" \ 619 "index 9432026..cd8fd12 100644\n" \ 620 "--- a/file.txt\n" \ 621 "+++ \"b/foo\\\"bar.txt\"\n" \ 622 "@@ -3,7 +3,7 @@ this is some context!\n" \ 623 " around some lines\n" \ 624 " that will change\n" \ 625 " yes it is!\n" \ 626 "-(this line is changed)\n" \ 627 "+(THIS line is changed!)\n" \ 628 " and this\n" \ 629 " is additional context\n" \ 630 " below it!\n" 631 632 #define PATCH_MODECHANGE_UNCHANGED \ 633 "diff --git a/file.txt b/file.txt\n" \ 634 "old mode 100644\n" \ 635 "new mode 100755\n" 636 637 #define PATCH_MODECHANGE_MODIFIED \ 638 "diff --git a/file.txt b/file.txt\n" \ 639 "old mode 100644\n" \ 640 "new mode 100755\n" \ 641 "index 9432026..cd8fd12\n" \ 642 "--- a/file.txt\n" \ 643 "+++ b/file.txt\n" \ 644 "@@ -3,7 +3,7 @@ this is some context!\n" \ 645 " around some lines\n" \ 646 " that will change\n" \ 647 " yes it is!\n" \ 648 "-(this line is changed)\n" \ 649 "+(THIS line is changed!)\n" \ 650 " and this\n" \ 651 " is additional context\n" \ 652 " below it!\n" 653 654 #define PATCH_NOISY \ 655 "This is some\nleading noise\n@@ - that\nlooks like a hunk header\n" \ 656 "but actually isn't and should parse ok\n" \ 657 PATCH_ORIGINAL_TO_CHANGE_MIDDLE \ 658 "plus some trailing garbage for good measure\n" 659 660 #define PATCH_NOISY_NOCONTEXT \ 661 "This is some\nleading noise\n@@ - that\nlooks like a hunk header\n" \ 662 "but actually isn't and should parse ok\n" \ 663 PATCH_ORIGINAL_TO_CHANGE_MIDDLE_NOCONTEXT \ 664 "plus some trailing garbage for good measure\n" 665 666 #define PATCH_TRUNCATED_1 \ 667 "diff --git a/file.txt b/file.txt\n" \ 668 "index 9432026..cd8fd12 100644\n" \ 669 "--- a/file.txt\n" \ 670 "+++ b/file.txt\n" \ 671 "@@ -3,7 +3,7 @@ this is some context!\n" \ 672 " around some lines\n" \ 673 " that will change\n" \ 674 " yes it is!\n" \ 675 "-(this line is changed)\n" \ 676 "+(THIS line is changed!)\n" \ 677 " and this\n" 678 679 #define PATCH_TRUNCATED_2 \ 680 "diff --git a/file.txt b/file.txt\n" \ 681 "index 9432026..cd8fd12 100644\n" \ 682 "--- a/file.txt\n" \ 683 "+++ b/file.txt\n" \ 684 "@@ -3,7 +3,7 @@ this is some context!\n" \ 685 " around some lines\n" \ 686 "-(this line is changed)\n" \ 687 "+(THIS line is changed!)\n" \ 688 " and this\n" \ 689 " is additional context\n" \ 690 " below it!\n" 691 692 #define PATCH_TRUNCATED_3 \ 693 "diff --git a/file.txt b/file.txt\n" \ 694 "index 9432026..cd8fd12 100644\n" \ 695 "--- a/file.txt\n" \ 696 "+++ b/file.txt\n" \ 697 "@@ -3,7 +3,7 @@ this is some context!\n" \ 698 " around some lines\n" \ 699 " that will change\n" \ 700 " yes it is!\n" \ 701 "+(THIS line is changed!)\n" \ 702 " and this\n" \ 703 " is additional context\n" \ 704 " below it!\n" 705 706 #define FILE_EMPTY_CONTEXT_ORIGINAL \ 707 "this\nhas\nan\n\nempty\ncontext\nline\n" 708 709 #define FILE_EMPTY_CONTEXT_MODIFIED \ 710 "this\nhas\nan\n\nempty...\ncontext\nline\n" 711 712 #define PATCH_EMPTY_CONTEXT \ 713 "diff --git a/file.txt b/file.txt\n" \ 714 "index 398d2df..bb15234 100644\n" \ 715 "--- a/file.txt\n" \ 716 "+++ b/file.txt\n" \ 717 "@@ -2,6 +2,6 @@ this\n" \ 718 " has\n" \ 719 " an\n" \ 720 "\n" \ 721 "-empty\n" \ 722 "+empty...\n" \ 723 " context\n" \ 724 " line\n" 725 726 #define FILE_APPEND_NO_NL \ 727 "hey!\n" \ 728 "this is some context!\n" \ 729 "around some lines\n" \ 730 "that will change\n" \ 731 "yes it is!\n" \ 732 "(this line is changed)\n" \ 733 "and this\n" \ 734 "is additional context\n" \ 735 "below it!\n" \ 736 "added line with no nl" 737 738 #define PATCH_APPEND_NO_NL \ 739 "diff --git a/file.txt b/file.txt\n" \ 740 "index 9432026..83759c0 100644\n" \ 741 "--- a/file.txt\n" \ 742 "+++ b/file.txt\n" \ 743 "@@ -7,3 +7,4 @@ yes it is!\n" \ 744 " and this\n" \ 745 " is additional context\n" \ 746 " below it!\n" \ 747 "+added line with no nl\n" \ 748 "\\ No newline at end of file\n" 749 750 #define PATCH_APPEND_NO_NL_IN_OLD_FILE \ 751 "diff --git a/file.txt b/file.txt\n" \ 752 "index 9432026..83759c0 100644\n" \ 753 "--- a/file.txt\n" \ 754 "+++ b/file.txt\n" \ 755 "@@ -1,1 +1,1 @@\n" \ 756 "-foo\n" \ 757 "\\ No newline at end of file\n" \ 758 "+foo\n" 759 760 #define PATCH_NAME_WHITESPACE \ 761 "diff --git a/file with spaces.txt b/file with spaces.txt\n" \ 762 "index 9432026..83759c0 100644\n" \ 763 "--- a/file with spaces.txt\n" \ 764 "+++ b/file with spaces.txt\n" \ 765 "@@ -0,3 +0,2 @@\n" \ 766 " and this\n" \ 767 "-is additional context\n" \ 768 " below it!\n" \ 769 770 #define PATCH_CORRUPT_GIT_HEADER \ 771 "diff --git a/file.txt\n" \ 772 "index 9432026..0f39b9a 100644\n" \ 773 "--- a/file.txt\n" \ 774 "+++ b/file.txt\n" \ 775 "@@ -0,0 +1 @@\n" \ 776 "+insert at front\n" 777 778 #define PATCH_CORRUPT_MISSING_NEW_FILE \ 779 "diff --git a/file.txt b/file.txt\n" \ 780 "index 9432026..cd8fd12 100644\n" \ 781 "--- a/file.txt\n" \ 782 "@@ -6 +6 @@ yes it is!\n" \ 783 "-(this line is changed)\n" \ 784 "+(THIS line is changed!)\n" 785 786 #define PATCH_CORRUPT_MISSING_OLD_FILE \ 787 "diff --git a/file.txt b/file.txt\n" \ 788 "index 9432026..cd8fd12 100644\n" \ 789 "+++ b/file.txt\n" \ 790 "@@ -6 +6 @@ yes it is!\n" \ 791 "-(this line is changed)\n" \ 792 "+(THIS line is changed!)\n" 793 794 #define PATCH_CORRUPT_NO_CHANGES \ 795 "diff --git a/file.txt b/file.txt\n" \ 796 "index 9432026..cd8fd12 100644\n" \ 797 "--- a/file.txt\n" \ 798 "+++ b/file.txt\n" \ 799 "@@ -0,0 +0,0 @@ yes it is!\n" 800 801 #define PATCH_CORRUPT_MISSING_HUNK_HEADER \ 802 "diff --git a/file.txt b/file.txt\n" \ 803 "index 9432026..cd8fd12 100644\n" \ 804 "--- a/file.txt\n" \ 805 "+++ b/file.txt\n" \ 806 "-(this line is changed)\n" \ 807 "+(THIS line is changed!)\n" 808 809 #define PATCH_NOT_A_PATCH \ 810 "+++this is not\n" \ 811 "--actually even\n" \ 812 " a legitimate \n" \ 813 "+patch file\n" \ 814 "-it's something else\n" \ 815 " entirely!" 816 817 /* binary contents */ 818 819 #define FILE_BINARY_LITERAL_ORIGINAL "\x00\x00\x0a" 820 #define FILE_BINARY_LITERAL_ORIGINAL_LEN 3 821 822 #define FILE_BINARY_LITERAL_MODIFIED "\x00\x00\x01\x02\x0a" 823 #define FILE_BINARY_LITERAL_MODIFIED_LEN 5 824 825 #define PATCH_BINARY_LITERAL \ 826 "diff --git a/binary.bin b/binary.bin\n" \ 827 "index bd474b2519cc15eab801ff851cc7d50f0dee49a1..9ac35ff15cd8864aeafd889e4826a3150f0b06c4 100644\n" \ 828 "GIT binary patch\n" \ 829 "literal 5\n" \ 830 "Mc${NkU}WL~000&M4gdfE\n" \ 831 "\n" \ 832 "literal 3\n" \ 833 "Kc${Nk-~s>u4FC%O\n\n" 834 835 #define FILE_BINARY_DELTA_ORIGINAL \ 836 "\x00\x00\x01\x02\x00\x00\x01\x02\x00\x00\x01\x02\x0a\x54\x68\x69" \ 837 "\x73\x20\x69\x73\x20\x61\x20\x62\x69\x6e\x61\x72\x79\x20\x66\x69" \ 838 "\x6c\x65\x2c\x20\x62\x79\x20\x76\x69\x72\x74\x75\x65\x20\x6f\x66" \ 839 "\x20\x68\x61\x76\x69\x6e\x67\x20\x73\x6f\x6d\x65\x20\x6e\x75\x6c" \ 840 "\x6c\x73\x2e\x0a\x00\x00\x01\x02\x00\x00\x01\x02\x00\x00\x01\x02" \ 841 "\x0a\x57\x65\x27\x72\x65\x20\x67\x6f\x69\x6e\x67\x20\x74\x6f\x20" \ 842 "\x63\x68\x61\x6e\x67\x65\x20\x70\x6f\x72\x74\x69\x6f\x6e\x73\x20" \ 843 "\x6f\x66\x20\x69\x74\x2e\x0a\x00\x00\x01\x02\x00\x00\x01\x02\x00" \ 844 "\x00\x01\x02\x0a\x53\x6f\x20\x74\x68\x61\x74\x20\x77\x65\x20\x67" \ 845 "\x69\x74\x20\x61\x20\x62\x69\x6e\x61\x72\x79\x20\x64\x65\x6c\x74" \ 846 "\x61\x20\x69\x6e\x73\x74\x65\x61\x64\x20\x6f\x66\x20\x74\x68\x65" \ 847 "\x20\x64\x65\x66\x6c\x61\x74\x65\x64\x20\x63\x6f\x6e\x74\x65\x6e" \ 848 "\x74\x73\x2e\x0a\x00\x00\x01\x02\x00\x00\x01\x02\x00\x00\x01\x02" \ 849 "\x0a" 850 #define FILE_BINARY_DELTA_ORIGINAL_LEN 209 851 852 #define FILE_BINARY_DELTA_MODIFIED \ 853 "\x00\x00\x01\x02\x00\x00\x01\x02\x00\x00\x01\x02\x0a\x5a\x5a\x5a" \ 854 "\x5a\x20\x69\x73\x20\x61\x20\x62\x69\x6e\x61\x72\x79\x20\x66\x69" \ 855 "\x6c\x65\x2c\x20\x62\x79\x20\x76\x69\x72\x74\x75\x65\x20\x6f\x66" \ 856 "\x20\x68\x61\x76\x69\x6e\x67\x20\x73\x6f\x6d\x65\x20\x6e\x75\x6c" \ 857 "\x6c\x73\x2e\x0a\x00\x00\x01\x02\x00\x00\x01\x02\x00\x00\x01\x02" \ 858 "\x0a\x57\x65\x27\x72\x65\x20\x67\x6f\x69\x6e\x67\x20\x74\x6f\x20" \ 859 "\x63\x68\x61\x6e\x67\x65\x20\x70\x6f\x72\x74\x69\x6f\x6e\x73\x20" \ 860 "\x6f\x66\x20\x49\x54\x2e\x0a\x00\x00\x01\x02\x00\x00\x01\x02\x00" \ 861 "\x00\x01\x02\x0a\x53\x4f\x20\x74\x68\x61\x74\x20\x77\x65\x20\x67" \ 862 "\x69\x74\x20\x61\x20\x62\x69\x6e\x61\x72\x79\x20\x64\x65\x6c\x74" \ 863 "\x61\x20\x69\x6e\x73\x74\x65\x61\x64\x20\x6f\x66\x20\x74\x68\x65" \ 864 "\x20\x64\x65\x66\x6c\x61\x74\x65\x64\x20\x63\x6f\x6e\x74\x65\x6e" \ 865 "\x74\x73\x2e\x0a\x00\x00\x01\x02\x00\x00\x01\x02\x00\x00\x01\x02" \ 866 "\x0a" 867 #define FILE_BINARY_DELTA_MODIFIED_LEN 209 868 869 #define PATCH_BINARY_DELTA \ 870 "diff --git a/binary.bin b/binary.bin\n" \ 871 "index 27184d9883b12c4c9c54b4a31137603586169f51..7c94f9e60bf366033d98e0d551ae37d30faef74a 100644\n" \ 872 "GIT binary patch\n" \ 873 "delta 48\n" \ 874 "kc$~Y)c#%<%fq{_;hPk4EV4`4>uxE%K7m7r%|HL+L0In7XGynhq\n" \ 875 "\n" \ 876 "delta 48\n" \ 877 "mc$~Y)c#%<%fq{_;hPgsAGK(h)CJASj=y9P)1m{m|^9BI99|yz$\n\n" 878 879 #define PATCH_BINARY_ADD \ 880 "diff --git a/binary.bin b/binary.bin\n" \ 881 "new file mode 100644\n" \ 882 "index 0000000000000000000000000000000000000000..7c94f9e60bf366033d98e0d551ae37d30faef74a\n" \ 883 "GIT binary patch\n" \ 884 "literal 209\n" \ 885 "zc${60u?oUK5JXSQe8qG&;(u6KC<u0&+$Ohh?#kUJlD{_rLCL^0!@QXgcKh&k^H>C_\n" \ 886 "zAhe=XX7rNzh<3&##YcwqNHmEKsP<&&m~%Zf;eX@Khr$?aExDmfqyyt+#l^I)3+LMg\n" \ 887 "kxnAIj9Pfn_|Gh`fP7tlm6j#y{FJYg_IifRlR^R@A08f862mk;8\n" \ 888 "\n" \ 889 "literal 0\n" \ 890 "Hc$@<O00001\n\n" 891 892 #define PATCH_BINARY_DELETE \ 893 "diff --git a/binary.bin b/binary.bin\n" \ 894 "deleted file mode 100644\n" \ 895 "index 7c94f9e60bf366033d98e0d551ae37d30faef74a..0000000000000000000000000000000000000000\n" \ 896 "GIT binary patch\n" \ 897 "literal 0\n" \ 898 "Hc$@<O00001\n" \ 899 "\n" \ 900 "literal 209\n" \ 901 "zc${60u?oUK5JXSQe8qG&;(u6KC<u0&+$Ohh?#kUJlD{_rLCL^0!@QXgcKh&k^H>C_\n" \ 902 "zAhe=XX7rNzh<3&##YcwqNHmEKsP<&&m~%Zf;eX@Khr$?aExDmfqyyt+#l^I)3+LMg\n" \ 903 "kxnAIj9Pfn_|Gh`fP7tlm6j#y{FJYg_IifRlR^R@A08f862mk;8\n\n" 904 905 /* contains an old side that does not match the expected source */ 906 #define PATCH_BINARY_NOT_REVERSIBLE \ 907 "diff --git a/binary.bin b/binary.bin\n" \ 908 "index 27184d9883b12c4c9c54b4a31137603586169f51..7c94f9e60bf366033d98e0d551ae37d30faef74a 100644\n" \ 909 "GIT binary patch\n" \ 910 "literal 5\n" \ 911 "Mc${NkU}WL~000&M4gdfE\n" \ 912 "\n" \ 913 "delta 48\n" \ 914 "mc$~Y)c#%<%fq{_;hPgsAGK(h)CJASj=y9P)1m{m|^9BI99|yz$\n\n" 915 916 #define PATCH_BINARY_NOT_PRINTED \ 917 "diff --git a/binary.bin b/binary.bin\n" \ 918 "index 27184d9..7c94f9e 100644\n" \ 919 "Binary files a/binary.bin and b/binary.bin differ\n" 920 921 #define PATCH_ADD_BINARY_NOT_PRINTED \ 922 "diff --git a/test.bin b/test.bin\n" \ 923 "new file mode 100644\n" \ 924 "index 0000000..9e0f96a\n" \ 925 "Binary files /dev/null and b/test.bin differ\n" 926 927 #define PATCH_ORIGINAL_NEW_FILE_WITH_SPACE \ 928 "diff --git a/sp ace.txt b/sp ace.txt\n" \ 929 "new file mode 100644\n" \ 930 "index 000000000..789819226\n" \ 931 "--- /dev/null\n" \ 932 "+++ b/sp ace.txt\n" \ 933 "@@ -0,0 +1 @@\n" \ 934 "+a\n" 935 936 #define PATCH_CRLF \ 937 "diff --git a/test-file b/test-file\r\n" \ 938 "new file mode 100644\r\n" \ 939 "index 0000000..af431f2 100644\r\n" \ 940 "--- /dev/null\r\n" \ 941 "+++ b/test-file\r\n" \ 942 "@@ -0,0 +1 @@\r\n" \ 943 "+a contents\r\n" 944 945 #define PATCH_NO_EXTENDED_HEADERS \ 946 "diff --git a/file b/file\n" \ 947 "--- a/file\n" \ 948 "+++ b/file\n" \ 949 "@@ -1,3 +1,3 @@\n" \ 950 " a\n" \ 951 "-b\n" \ 952 "+bb\n" \ 953 " c\n" 954 955 #define PATCH_BINARY_FILE_WITH_MISSING_PATHS \ 956 "diff --git \n" \ 957 "--- \n" \ 958 "+++ \n" \ 959 "Binary files " 960 961 #define PATCH_BINARY_FILE_WITH_WHITESPACE_PATHS \ 962 "diff --git a/file b/file\n" \ 963 "--- \n" \ 964 "+++ \n" \ 965 "Binary files " 966 967 #define PATCH_BINARY_FILE_WITH_QUOTED_EMPTY_PATHS \ 968 "diff --git a/file b/file\n" \ 969 "--- \"\"\n" \ 970 "+++ \"\"\n" \ 971 "Binary files " 972 973 #define PATCH_BINARY_FILE_PATH_WITH_SPACES \ 974 "diff --git a b c d e f\n" \ 975 "--- a b c\n" \ 976 "+++ d e f\n" \ 977 "Binary files a b c and d e f differ" 978 979 #define PATCH_BINARY_FILE_PATH_WITHOUT_BODY_PATHS \ 980 "diff --git a b c d e f\n" \ 981 "--- \n" \ 982 "+++ \n" \ 983 "Binary files a b c and d e f differ" 984 985 #define PATCH_BINARY_FILE_WITH_TRUNCATED_DELTA \ 986 "diff --git a/file b/file\n" \ 987 "index 1420..b71f\n" \ 988 "GIT binary patch\n" \ 989 "delta 7\n" \ 990 "d" 991 992 #define PATCH_MULTIPLE_OLD_PATHS \ 993 "diff --git \n" \ 994 "--- \n" \ 995 "+++ \n" \ 996 "index 0000..7DDb\n" \ 997 "--- \n" 998 999 #define PATCH_INTMAX_NEW_LINES \ 1000 "diff --git a/file b/file\n" \ 1001 "--- a/file\n" \ 1002 "+++ b/file\n" \ 1003 "@@ -0 +2147483647 @@\n" \ 1004 "\n" \ 1005 " " 1006