* Check for arguments that don't resolve as actual files, * but which look sufficiently like pathspecs that we'll consider * them such for the purposes of rev/pathspec DWIM parsing. */
| 230 | * them such for the purposes of rev/pathspec DWIM parsing. |
| 231 | */ |
| 232 | static int looks_like_pathspec(const char *arg) |
| 233 | { |
| 234 | const char *p; |
| 235 | int escaped = 0; |
| 236 | |
| 237 | /* |
| 238 | * Wildcard characters imply the user is looking to match pathspecs |
| 239 | * that aren't in the filesystem. Note that this doesn't include |
| 240 | * backslash even though it's a glob special; by itself it doesn't |
| 241 | * cause any increase in the match. Likewise ignore backslash-escaped |
| 242 | * wildcard characters. |
| 243 | */ |
| 244 | for (p = arg; *p; p++) { |
| 245 | if (escaped) { |
| 246 | escaped = 0; |
| 247 | } else if (is_glob_special(*p)) { |
| 248 | if (*p == '\\') |
| 249 | escaped = 1; |
| 250 | else |
| 251 | return 1; |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | /* long-form pathspec magic */ |
| 256 | if (starts_with(arg, ":(")) |
| 257 | return 1; |
| 258 | |
| 259 | return 0; |
| 260 | } |
| 261 | |
| 262 | /* |
| 263 | * Verify a filename that we got as an argument for a pathspec |
no test coverage detected