| 657 | } |
| 658 | |
| 659 | static inline int patchbreak(const struct strbuf *line) |
| 660 | { |
| 661 | size_t i; |
| 662 | |
| 663 | /* Beginning of a "diff -" header? */ |
| 664 | if (starts_with(line->buf, "diff -")) |
| 665 | return 1; |
| 666 | |
| 667 | /* CVS "Index: " line? */ |
| 668 | if (starts_with(line->buf, "Index: ")) |
| 669 | return 1; |
| 670 | |
| 671 | /* |
| 672 | * "--- <filename>" starts patches without headers |
| 673 | * "---<sp>*" is a manual separator |
| 674 | */ |
| 675 | if (line->len < 4) |
| 676 | return 0; |
| 677 | |
| 678 | if (starts_with(line->buf, "---")) { |
| 679 | /* space followed by a filename? */ |
| 680 | if (line->buf[3] == ' ' && !isspace(line->buf[4])) |
| 681 | return 1; |
| 682 | /* Just whitespace? */ |
| 683 | for (i = 3; i < line->len; i++) { |
| 684 | unsigned char c = line->buf[i]; |
| 685 | if (c == '\n') |
| 686 | return 1; |
| 687 | if (!isspace(c)) |
| 688 | break; |
| 689 | } |
| 690 | return 0; |
| 691 | } |
| 692 | return 0; |
| 693 | } |
| 694 | |
| 695 | static int is_scissors_line(const char *line) |
| 696 | { |
no test coverage detected