|
||||
File indexing completed on 2025-01-18 09:59:37
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 #ifndef INCLUDE_git_ignore_h__ 0008 #define INCLUDE_git_ignore_h__ 0009 0010 #include "common.h" 0011 #include "types.h" 0012 0013 GIT_BEGIN_DECL 0014 0015 /** 0016 * Add ignore rules for a repository. 0017 * 0018 * Excludesfile rules (i.e. .gitignore rules) are generally read from 0019 * .gitignore files in the repository tree or from a shared system file 0020 * only if a "core.excludesfile" config value is set. The library also 0021 * keeps a set of per-repository internal ignores that can be configured 0022 * in-memory and will not persist. This function allows you to add to 0023 * that internal rules list. 0024 * 0025 * Example usage: 0026 * 0027 * error = git_ignore_add_rule(myrepo, "*.c\ndir/\nFile with space\n"); 0028 * 0029 * This would add three rules to the ignores. 0030 * 0031 * @param repo The repository to add ignore rules to. 0032 * @param rules Text of rules, the contents to add on a .gitignore file. 0033 * It is okay to have multiple rules in the text; if so, 0034 * each rule should be terminated with a newline. 0035 * @return 0 on success 0036 */ 0037 GIT_EXTERN(int) git_ignore_add_rule( 0038 git_repository *repo, 0039 const char *rules); 0040 0041 /** 0042 * Clear ignore rules that were explicitly added. 0043 * 0044 * Resets to the default internal ignore rules. This will not turn off 0045 * rules in .gitignore files that actually exist in the filesystem. 0046 * 0047 * The default internal ignores ignore ".", ".." and ".git" entries. 0048 * 0049 * @param repo The repository to remove ignore rules from. 0050 * @return 0 on success 0051 */ 0052 GIT_EXTERN(int) git_ignore_clear_internal_rules( 0053 git_repository *repo); 0054 0055 /** 0056 * Test if the ignore rules apply to a given path. 0057 * 0058 * This function checks the ignore rules to see if they would apply to the 0059 * given file. This indicates if the file would be ignored regardless of 0060 * whether the file is already in the index or committed to the repository. 0061 * 0062 * One way to think of this is if you were to do "git check-ignore --no-index" 0063 * on the given file, would it be shown or not? 0064 * 0065 * @param ignored boolean returning 0 if the file is not ignored, 1 if it is 0066 * @param repo a repository object 0067 * @param path the file to check ignores for, relative to the repo's workdir. 0068 * @return 0 if ignore rules could be processed for the file (regardless 0069 * of whether it exists or not), or an error < 0 if they could not. 0070 */ 0071 GIT_EXTERN(int) git_ignore_path_is_ignored( 0072 int *ignored, 0073 git_repository *repo, 0074 const char *path); 0075 0076 GIT_END_DECL 0077 0078 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |