| 1045 | } |
| 1046 | |
| 1047 | static bool gf_relative_path(const char *path, size_t n) { |
| 1048 | if (!path || !n || n > GF_INPUT_MAX || path[0] == '/' || memchr(path, '\0', n)) |
| 1049 | return false; |
| 1050 | #ifdef _WIN32 |
| 1051 | /* Windows Git normalizes backslashes before lookup. Reject that spelling |
| 1052 | * rather than silently selecting a different Git tree path. */ |
| 1053 | if (memchr(path, '\\', n) || (n >= 2 && path[1] == ':') || |
| 1054 | MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, path, (int)n, NULL, 0) == 0) |
| 1055 | return false; |
| 1056 | #endif |
| 1057 | size_t begin = 0; |
| 1058 | for (size_t i = 0; i <= n; i++) { |
| 1059 | if (i != n && path[i] != '/') |
| 1060 | continue; |
| 1061 | size_t length = i - begin; |
| 1062 | if (!length || (length == 1 && path[begin] == '.') || |
| 1063 | (length == 2 && path[begin] == '.' && path[begin + 1] == '.')) |
| 1064 | return false; |
| 1065 | begin = i + 1; |
| 1066 | } |
| 1067 | return true; |
| 1068 | } |
| 1069 | |
| 1070 | static const char *gf_revision(const cbm_git_facts_t *facts, cbm_git_revision_t revision) { |
| 1071 | switch (revision) { |
no outgoing calls
no test coverage detected