summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
authorRussell Belfer <arrbee@arrbee.com>2012-01-16 15:16:44 -0800
committerRussell Belfer <arrbee@arrbee.com>2012-01-16 15:16:44 -0800
commitcfbc880d8a407bcd2074dda4221d337daf72195c (patch)
treeeb1cd2d1be66c2b5604fbe3699b38aae984851b3 /include/git2
parent1dbcc9fc4e6f5264d5bb46f6d7f744eb4a4063e4 (diff)
downloadlibgit2-cfbc880d8a407bcd2074dda4221d337daf72195c.tar.gz
Patch cleanup for merge
After reviewing the gitignore support with Vicent, we came up with a list of minor cleanups to prepare for merge, including: * checking git_repository_config error returns * renaming git_ignore_is_ignored and moving to status.h * fixing next_line skipping to include \r skips * commenting on where ignores are and are not included
Diffstat (limited to 'include/git2')
-rw-r--r--include/git2/index.h4
-rw-r--r--include/git2/status.h16
2 files changed, 20 insertions, 0 deletions
diff --git a/include/git2/index.h b/include/git2/index.h
index 627d6c4fd..5018c896b 100644
--- a/include/git2/index.h
+++ b/include/git2/index.h
@@ -169,6 +169,10 @@ GIT_EXTERN(void) git_index_uniq(git_index *index);
*
* This method will fail in bare index instances.
*
+ * This forces the file to be added to the index, not looking
+ * at gitignore rules. Those rules can be evaluated through
+ * the git_status APIs (in status.h) before calling this.
+ *
* @param index an existing index object
* @param path filename to add
* @param stage stage for the entry
diff --git a/include/git2/status.h b/include/git2/status.h
index 0f2b63de4..c0f38c508 100644
--- a/include/git2/status.h
+++ b/include/git2/status.h
@@ -58,6 +58,22 @@ GIT_EXTERN(int) git_status_foreach(git_repository *repo, int (*callback)(const c
*/
GIT_EXTERN(int) git_status_file(unsigned int *status_flags, git_repository *repo, const char *path);
+/**
+ * Test if the ignore rules apply to a given file.
+ *
+ * This function simply checks the ignore rules to see if they would apply
+ * to the given file. Unlike git_status_file(), this indicates if the file
+ * would be ignored regardless of whether the file is already in the index
+ * or in the repository.
+ *
+ * @param repo a repository object
+ * @param path the file to check ignores for, rooted at the repo's workdir
+ * @param ignored boolean returning 0 if the file is not ignored, 1 if it is
+ * @return GIT_SUCCESS if the ignore rules could be processed for the file
+ * (regardless of whether it exists or not), or an error < 0 if they could not.
+ */
+GIT_EXTERN(int) git_status_should_ignore(git_repository *repo, const char *path, int *ignored);
+
/** @} */
GIT_END_DECL
#endif