summaryrefslogtreecommitdiff
path: root/src/fileops.c
diff options
context:
space:
mode:
authorRussell Belfer <arrbee@arrbee.com>2012-01-09 15:37:19 -0800
committerRussell Belfer <arrbee@arrbee.com>2012-01-11 14:39:51 -0800
commitdf743c7d3a04553ffc04ae7cbc64fb300e7f61d2 (patch)
tree7f0dfa714ddb292448cbeaa69f2b5d90a3274d85 /src/fileops.c
parent7e443f696068cd8c84a759e532c2845348e5a6ad (diff)
downloadlibgit2-df743c7d3a04553ffc04ae7cbc64fb300e7f61d2.tar.gz
Initial implementation of gitignore support
Adds support for .gitignore files to git_status_foreach() and git_status_file(). This includes refactoring the gitattributes code to share logic where possible. The GIT_STATUS_IGNORED flag will now be passed in for files that are ignored (provided they are not already in the index or the head of repo).
Diffstat (limited to 'src/fileops.c')
-rw-r--r--src/fileops.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/fileops.c b/src/fileops.c
index 48bd3514d..f481bb01d 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -534,3 +534,15 @@ int git_futils_find_system_file(git_buf *path, const char *filename)
#endif
}
+int git_futils_dir_for_path(git_buf *dir, const char *path, const char *base)
+{
+ if (git_path_prettify(dir, path, base) == GIT_SUCCESS) {
+ /* call dirname if this is not a directory */
+ if (git_futils_isdir(dir->ptr) != GIT_SUCCESS)
+ git_path_dirname_r(dir, dir->ptr);
+
+ git_path_to_dir(dir);
+ }
+
+ return git_buf_lasterror(dir);
+}