Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:36

0001 /*
0002  * Copyright (C) the libgit2 contributors. All rights reserved.
0003  *
0004  * This file is part of libgit2, distributed under the GNU GPL v2 with
0005  * a Linking Exception. For full terms see the included COPYING file.
0006  */
0007 
0008 #ifndef INCLUDE_sys_git_path_h__
0009 #define INCLUDE_sys_git_path_h__
0010 
0011 #include "git2/common.h"
0012 
0013 GIT_BEGIN_DECL
0014 
0015 /**
0016  * The kinds of git-specific files we know about.
0017  *
0018  * The order needs to stay the same to not break the `gitfiles`
0019  * array in path.c
0020  */
0021 typedef enum {
0022     /** Check for the .gitignore file */
0023     GIT_PATH_GITFILE_GITIGNORE,
0024     /** Check for the .gitmodules file */
0025     GIT_PATH_GITFILE_GITMODULES,
0026     /** Check for the .gitattributes file */
0027     GIT_PATH_GITFILE_GITATTRIBUTES
0028 } git_path_gitfile;
0029 
0030 /**
0031  * The kinds of checks to perform according to which filesystem we are trying to
0032  * protect.
0033  */
0034 typedef enum {
0035     /** Do both NTFS- and HFS-specific checks */
0036     GIT_PATH_FS_GENERIC,
0037     /** Do NTFS-specific checks only */
0038     GIT_PATH_FS_NTFS,
0039     /** Do HFS-specific checks only */
0040     GIT_PATH_FS_HFS
0041 } git_path_fs;
0042 
0043 /**
0044  * Check whether a path component corresponds to a .git$SUFFIX
0045  * file.
0046  *
0047  * As some filesystems do special things to filenames when
0048  * writing files to disk, you cannot always do a plain string
0049  * comparison to verify whether a file name matches an expected
0050  * path or not. This function can do the comparison for you,
0051  * depending on the filesystem you're on.
0052  *
0053  * @param path the path component to check
0054  * @param pathlen the length of `path` that is to be checked
0055  * @param gitfile which file to check against
0056  * @param fs which filesystem-specific checks to use
0057  * @return 0 in case the file does not match, a positive value if
0058  *         it does; -1 in case of an error
0059  */
0060 GIT_EXTERN(int) git_path_is_gitfile(const char *path, size_t pathlen, git_path_gitfile gitfile, git_path_fs fs);
0061 
0062 GIT_END_DECL
0063 
0064 #endif  /* INCLUDE_sys_git_path */