Git tree paths use '/' on every host; backslash/colon are literal bytes. */
| 33 | |
| 34 | /* Git tree paths use '/' on every host; backslash/colon are literal bytes. */ |
| 35 | static bool changes_path_valid(const unsigned char *path, size_t length) { |
| 36 | if (!length || path[0] == '/' || path[length - 1] == '/') { |
| 37 | return false; |
| 38 | } |
| 39 | size_t start = 0; |
| 40 | for (size_t i = 0; i <= length; i++) { |
| 41 | if (i < length && path[i] != '/') { |
| 42 | if (path[i] == 0) { |
| 43 | return false; |
| 44 | } |
| 45 | continue; |
| 46 | } |
| 47 | size_t component = i - start; |
| 48 | if (!component || (component == 1 && path[start] == '.') || |
| 49 | (component == 2 && path[start] == '.' && path[start + 1] == '.')) { |
| 50 | return false; |
| 51 | } |
| 52 | start = i + 1; |
| 53 | } |
| 54 | return true; |
| 55 | } |
| 56 | |
| 57 | static bool changes_record(const unsigned char *bytes, size_t length, size_t *offset, char *status, |
| 58 | changes_slice_t *path) { |
no outgoing calls
no test coverage detected