libgit2

git_path_is_gitfile

Version:

Check whether a path component corresponds to a .git$SUFFIX file.

As some filesystems do special things to filenames when writing files to disk, you cannot always do a plain string comparison to verify whether a file name matches an expected path or not. This function can do the comparison for you, depending on the filesystem you're on.

Signature

int git_path_is_gitfile(const char *path, size_t pathlen, git_path_gitfile gitfile, git_path_fs fs);

Parameters

const char *
In
path

the path component to check

size_t
In
pathlen

the length of path that is to be checked

In
gitfile

which file to check against

In
fs

which filesystem-specific checks to use

Returns

int

0 in case the file does not match, a positive value if it does; -1 in case of an error

Versions