MCPcopy Index your code
hub / github.com/git/git / is_ntfs_dotgit

Function is_ntfs_dotgit

path.c:1415–1449  ·  view source on GitHub ↗

* On NTFS, we need to be careful to disallow certain synonyms of the `.git/` * directory: * * - For historical reasons, file names that end in spaces or periods are * automatically trimmed. Therefore, `.git . . ./` is a valid way to refer * to `.git/`. * * - For other historical reasons, file names that do not conform to the 8.3 * format (up to eight characters for the basename, thre

Source from the content-addressed store, hash-verified

1413 * as directory separators.
1414 */
1415int is_ntfs_dotgit(const char *name)
1416{
1417 char c;
1418
1419 /*
1420 * Note that when we don't find `.git` or `git~1` we end up with `name`
1421 * advanced partway through the string. That's okay, though, as we
1422 * return immediately in those cases, without looking at `name` any
1423 * further.
1424 */
1425 c = *(name++);
1426 if (c == '.') {
1427 /* .git */
1428 if (((c = *(name++)) != 'g' && c != 'G') ||
1429 ((c = *(name++)) != 'i' && c != 'I') ||
1430 ((c = *(name++)) != 't' && c != 'T'))
1431 return 0;
1432 } else if (c == 'g' || c == 'G') {
1433 /* git ~1 */
1434 if (((c = *(name++)) != 'i' && c != 'I') ||
1435 ((c = *(name++)) != 't' && c != 'T') ||
1436 *(name++) != '~' ||
1437 *(name++) != '1')
1438 return 0;
1439 } else
1440 return 0;
1441
1442 for (;;) {
1443 c = *(name++);
1444 if (!c || is_xplatform_dir_sep(c) || c == ':')
1445 return 1;
1446 if (c != '.' && c != ' ')
1447 return 0;
1448 }
1449}
1450
1451static int is_ntfs_dot_generic(const char *name,
1452 const char *dotgit_name,

Callers 2

fsck_treeFunction · 0.85
verify_path_internalFunction · 0.85

Calls 1

is_xplatform_dir_sepFunction · 0.85

Tested by

no test coverage detected