1 /* 2 * Copyright (C) the libgit2 contributors. All rights reserved. 3 * 4 * This file is part of libgit2, distributed under the GNU GPL v2 with 5 * a Linking Exception. For full terms see the included COPYING file. 6 */ 7 module libgit2_d.sys.path; 8 9 10 extern (C): 11 nothrow @nogc: 12 package(libgit2_d): 13 14 /** 15 * The kinds of git-specific files we know about. 16 * 17 * The order needs to stay the same to not break the `gitfiles` 18 * array in path.c 19 */ 20 enum git_path_gitfile 21 { 22 /** 23 * Check for the .gitignore file 24 */ 25 GIT_PATH_GITFILE_GITIGNORE, 26 27 /** 28 * Check for the .gitmodules file 29 */ 30 GIT_PATH_GITFILE_GITMODULES, 31 32 /** 33 * Check for the .gitattributes file 34 */ 35 GIT_PATH_GITFILE_GITATTRIBUTES, 36 } 37 38 /** 39 * The kinds of checks to perform according to which filesystem we are trying to 40 * protect. 41 */ 42 enum git_path_fs 43 { 44 /** 45 * Do both NTFS- and HFS-specific checks 46 */ 47 GIT_PATH_FS_GENERIC, 48 49 /** 50 * Do NTFS-specific checks only 51 */ 52 GIT_PATH_FS_NTFS, 53 54 /** 55 * Do HFS-specific checks only 56 */ 57 GIT_PATH_FS_HFS, 58 } 59 60 /** 61 * Check whether a path component corresponds to a .git$SUFFIX 62 * file. 63 * 64 * As some filesystems do special things to filenames when 65 * writing files to disk, you cannot always do a plain string 66 * comparison to verify whether a file name matches an expected 67 * path or not. This function can do the comparison for you, 68 * depending on the filesystem you're on. 69 * 70 * @param path the path component to check 71 * @param pathlen the length of `path` that is to be checked 72 * @param gitfile which file to check against 73 * @param fs which filesystem-specific checks to use 74 * @return 0 in case the file does not match, a positive value if 75 * it does; -1 in case of an error 76 */ 77 //GIT_EXTERN 78 int git_path_is_gitfile(const (char)* path, size_t pathlen, .git_path_gitfile gitfile, .git_path_fs fs);