Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
3e96ecf2
Commit
3e96ecf2
authored
Jul 08, 2013
by
Russell Belfer
Committed by
Vicent Marti
Jul 10, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve include/git2/pathspec.h docs
parent
9abc78ae
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
29 deletions
+46
-29
include/git2/pathspec.h
+46
-29
No files found.
include/git2/pathspec.h
View file @
3e96ecf2
...
@@ -25,20 +25,22 @@ typedef struct git_pathspec_match_list git_pathspec_match_list;
...
@@ -25,20 +25,22 @@ typedef struct git_pathspec_match_list git_pathspec_match_list;
* Options controlling how pathspec match should be executed
* Options controlling how pathspec match should be executed
*
*
* - GIT_PATHSPEC_IGNORE_CASE forces match to ignore case; otherwise
* - GIT_PATHSPEC_IGNORE_CASE forces match to ignore case; otherwise
* match will use native case sensitivity of platform
* match will use native case sensitivity of platform
filesystem
* - GIT_PATHSPEC_USE_CASE forces case sensitive match; otherwise
* - GIT_PATHSPEC_USE_CASE forces case sensitive match; otherwise
* match will use native case sensitivity of platform
* match will use native case sensitivity of platform
filesystem
* - GIT_PATHSPEC_NO_GLOB disables glob patterns and just uses simple
* - GIT_PATHSPEC_NO_GLOB disables glob patterns and just uses simple
* string comparison for matching
* string comparison for matching
* - GIT_PATHSPEC_NO_MATCH_ERROR means the match function will return
* - GIT_PATHSPEC_NO_MATCH_ERROR means the match functions return error
* GIT_ENOTFOUND if no matches are found; otherwise it will return 0
* code GIT_ENOTFOUND if no matches are found; otherwise no matches is
* for success and `git_pathspec_match_list_entrycount` will be 0.
* still success (return 0) but `git_pathspec_match_list_entrycount`
* - GIT_PATHSPEC_FIND_FAILURES only applies to a git_pathspec_match_list;
* will indicate 0 matches.
* it means to check file names against all unmatched patterns so that
* - GIT_PATHSPEC_FIND_FAILURES means that the `git_pathspec_match_list`
* at the end of a match we can identify patterns that did not match any
* should track which patterns matched which files so that at the end of
* files.
* the match we can identify patterns that did not match any files.
* - GIT_PATHSPEC_FAILURES_ONLY only applies to a git_pathspec_match_list;
* - GIT_PATHSPEC_FAILURES_ONLY means that the `git_pathspec_match_list`
* it means to only check for mismatches and not record matched paths.
* does not need to keep the actual matching filenames. Use this to
* just test if there were any matches at all or in combination with
* GIT_PATHSPEC_FIND_FAILURES to validate a pathspec.
*/
*/
typedef
enum
{
typedef
enum
{
GIT_PATHSPEC_DEFAULT
=
0
,
GIT_PATHSPEC_DEFAULT
=
0
,
...
@@ -54,7 +56,6 @@ typedef enum {
...
@@ -54,7 +56,6 @@ typedef enum {
* Compile a pathspec
* Compile a pathspec
*
*
* @param out Output of the compiled pathspec
* @param out Output of the compiled pathspec
* @param flags Combination of git_pathspec_flag_t values
* @param pathspec A git_strarray of the paths to match
* @param pathspec A git_strarray of the paths to match
* @return 0 on success, <0 on failure
* @return 0 on success, <0 on failure
*/
*/
...
@@ -77,7 +78,7 @@ GIT_EXTERN(void) git_pathspec_free(git_pathspec *ps);
...
@@ -77,7 +78,7 @@ GIT_EXTERN(void) git_pathspec_free(git_pathspec *ps);
* fall back on being case sensitive.
* fall back on being case sensitive.
*
*
* @param ps The compiled pathspec
* @param ps The compiled pathspec
* @param flags
Match flags to influence matching behavior
* @param flags
Combination of git_pathspec_flag_t options to control match
* @param path The pathname to attempt to match
* @param path The pathname to attempt to match
* @return 1 is path matches spec, 0 if it does not
* @return 1 is path matches spec, 0 if it does not
*/
*/
...
@@ -87,18 +88,24 @@ GIT_EXTERN(int) git_pathspec_matches_path(
...
@@ -87,18 +88,24 @@ GIT_EXTERN(int) git_pathspec_matches_path(
/**
/**
* Match a pathspec against the working directory of a repository.
* Match a pathspec against the working directory of a repository.
*
*
* This
returns a `git_patchspec_match` object that contains the list of
* This
matches the pathspec against the current files in the working
*
all files matching the given pathspec in the working directory of th
e
*
directory of the repository. It is an error to invoke this on a bar
e
* repo
sitory
. This handles git ignores (i.e. ignored files will not be
* repo. This handles git ignores (i.e. ignored files will not be
* considered to match the `pathspec` unless the file is tracked in the
* considered to match the `pathspec` unless the file is tracked in the
* index).
* index).
*
*
* @param out Object with list of matching items
* If `out` is not NULL, this returns a `git_patchspec_match_list`. That
* contains the list of all matched filenames (unless you pass the
* `GIT_PATHSPEC_FAILURES_ONLY` flag) and may also contain the list of
* pathspecs with no match (if you used the `GIT_PATHSPEC_FIND_FAILURES`
* flag). You must call `git_pathspec_match_list_free()` on this object.
*
* @param out Output list of matches; pass NULL to just get return value
* @param repo The repository in which to match; bare repo is an error
* @param repo The repository in which to match; bare repo is an error
* @param flags
Options to control matching behavior
* @param flags
Combination of git_pathspec_flag_t options to control match
* @param ps Pathspec to be matched
* @param ps Pathspec to be matched
* @return 0 on success, -1 on error, GIT_ENOTFOUND if no matches and
* @return 0 on success, -1 on error, GIT_ENOTFOUND if no matches and
* the GIT_PATHSPEC_NO_MATCH_ERROR flag
is used
* the GIT_PATHSPEC_NO_MATCH_ERROR flag
was given
*/
*/
GIT_EXTERN
(
int
)
git_pathspec_match_workdir
(
GIT_EXTERN
(
int
)
git_pathspec_match_workdir
(
git_pathspec_match_list
**
out
,
git_pathspec_match_list
**
out
,
...
@@ -109,17 +116,22 @@ GIT_EXTERN(int) git_pathspec_match_workdir(
...
@@ -109,17 +116,22 @@ GIT_EXTERN(int) git_pathspec_match_workdir(
/**
/**
* Match a pathspec against entries in an index.
* Match a pathspec against entries in an index.
*
*
* This returns a `git_patchspec_match` object that contains the list of
* This matches the pathspec against the files in the repository index.
* all files matching the given pathspec in the index.
*
*
* NOTE: At the moment, the case sensitivity of this match is controlled
* NOTE: At the moment, the case sensitivity of this match is controlled
* by the current case-sensitivity of the index object itself and the
* by the current case-sensitivity of the index object itself and the
* USE_CASE and IGNORE_CASE flags will have no effect. This behavior will
* USE_CASE and IGNORE_CASE flags will have no effect. This behavior will
* be corrected in a future release.
* be corrected in a future release.
*
*
* @param out Object with list of matching items
* If `out` is not NULL, this returns a `git_patchspec_match_list`. That
* @param inex The index in which to match
* contains the list of all matched filenames (unless you pass the
* @param flags Options to control matching behavior
* `GIT_PATHSPEC_FAILURES_ONLY` flag) and may also contain the list of
* pathspecs with no match (if you used the `GIT_PATHSPEC_FIND_FAILURES`
* flag). You must call `git_pathspec_match_list_free()` on this object.
*
* @param out Output list of matches; pass NULL to just get return value
* @param index The index to match against
* @param flags Combination of git_pathspec_flag_t options to control match
* @param ps Pathspec to be matched
* @param ps Pathspec to be matched
* @return 0 on success, -1 on error, GIT_ENOTFOUND if no matches and
* @return 0 on success, -1 on error, GIT_ENOTFOUND if no matches and
* the GIT_PATHSPEC_NO_MATCH_ERROR flag is used
* the GIT_PATHSPEC_NO_MATCH_ERROR flag is used
...
@@ -133,12 +145,17 @@ GIT_EXTERN(int) git_pathspec_match_index(
...
@@ -133,12 +145,17 @@ GIT_EXTERN(int) git_pathspec_match_index(
/**
/**
* Match a pathspec against files in a tree.
* Match a pathspec against files in a tree.
*
*
* This returns a `git_patchspec_match` object that contains the list of
* This matches the pathspec against the files in the given tree.
* all files matching the given pathspec in the given tree.
*
* If `out` is not NULL, this returns a `git_patchspec_match_list`. That
* contains the list of all matched filenames (unless you pass the
* `GIT_PATHSPEC_FAILURES_ONLY` flag) and may also contain the list of
* pathspecs with no match (if you used the `GIT_PATHSPEC_FIND_FAILURES`
* flag). You must call `git_pathspec_match_list_free()` on this object.
*
*
* @param out O
bject with list of matching items
* @param out O
utput list of matches; pass NULL to just get return value
* @param
inex The index in which to match
* @param
tree The root-level tree to match against
* @param flags
Options to control matching behavior
* @param flags
Combination of git_pathspec_flag_t options to control match
* @param ps Pathspec to be matched
* @param ps Pathspec to be matched
* @return 0 on success, -1 on error, GIT_ENOTFOUND if no matches and
* @return 0 on success, -1 on error, GIT_ENOTFOUND if no matches and
* the GIT_PATHSPEC_NO_MATCH_ERROR flag is used
* the GIT_PATHSPEC_NO_MATCH_ERROR flag is used
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment