| 212 | } |
| 213 | |
| 214 | int check_submodule_name(const char *name) |
| 215 | { |
| 216 | /* Disallow empty names */ |
| 217 | if (!*name) |
| 218 | return -1; |
| 219 | |
| 220 | /* |
| 221 | * Look for '..' as a path component. Check is_xplatform_dir_sep() as |
| 222 | * separators rather than is_dir_sep(), because we want the name rules |
| 223 | * to be consistent across platforms. |
| 224 | */ |
| 225 | goto in_component; /* always start inside component */ |
| 226 | while (*name) { |
| 227 | char c = *name++; |
| 228 | if (is_xplatform_dir_sep(c)) { |
| 229 | in_component: |
| 230 | if (name[0] == '.' && name[1] == '.' && |
| 231 | (!name[2] || is_xplatform_dir_sep(name[2]))) |
| 232 | return -1; |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | return 0; |
| 237 | } |
| 238 | |
| 239 | static int submodule_url_is_relative(const char *url) |
| 240 | { |
no test coverage detected