summaryrefslogtreecommitdiff
path: root/src/pathspec.c
Commit message (Collapse)AuthorAgeFilesLines
* Rename diff objects and split patch.hRussell Belfer2013-10-111-1/+1
| | | | | | This makes no functional change to diff but renames a couple of the objects and splits the new git_patch (formerly git_diff_patch) into a new header file.
* Match against file with leading ! was too broadRussell Belfer2013-08-091-1/+2
|
* Revert PR #1462 and provide alternative fixRussell Belfer2013-08-091-2/+11
| | | | | | | | | | | This rolls back the changes to fnmatch parsing from commit 2e40a60e847d6c128af23e24ea7a8efebd2427da except for the tests that were added. Instead this adds couple of new flags that can be passed in when attempting to parse an fnmatch pattern. Also, this changes the pathspec match logic to special case matching a filename with a '!' prefix against a negative pattern. This fixes the build.
* Merge pull request #1462 from yorah/fix/libgit2sharp-issue-379Russell Belfer2013-08-091-1/+1
|\ | | | | status: fix handling of filenames with special prefixes
| * status: fix handling of filenames with special prefixesyorah2013-04-151-1/+1
| | | | | | | | Fix libgit2/libgit2sharp#379
* | Add git_pathspec_match_diff APIRussell Belfer2013-07-101-75/+239
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds an additional pathspec API that will match a pathspec against a diff object. This is convenient if you want to handle renames (so you need the whole diff and can't use the pathspec constraint built into the diff API) but still want to tell if the diff had any files that matched the pathspec. When the pathspec is matched against a diff, instead of keeping a list of filenames that matched, instead the API keeps the list of git_diff_deltas that matched and they can be retrieved via a new API git_pathspec_match_list_diff_entry. There are a couple of other minor API extensions here that were mostly for the sake of convenience and to reduce dependencies on knowing the internal data structure between files inside the library.
* | Fix example/log.c pathspec handling of mergesRussell Belfer2013-07-101-8/+13
| | | | | | | | | | | | | | This fixes the way the example log program decides if a merge commit should be shown when a pathspec is given. Also makes it easier to use the pathspec API to just check "does a tree match anything in the pathspec" without allocating a match list.
* | Add public API for pathspec matchingRussell Belfer2013-07-101-49/+401
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a new public API for compiling pathspecs and matching them against the working directory, the index, or a tree from the repository. This also reworks the pathspec internals to allow the sharing of code between the existing internal usage of pathspec matching and the new external API. While this is working and the new API is ready for discussion, I think there is still an incorrect behavior in which patterns are always matched against the full path of an entry without taking the subdirectories into account (so "s*" will match "subdir/file" even though it wouldn't with core Git). Further enhancements are coming, but this was a good place to take a functional snapshot.
* | Add higher level pathspec APIRussell Belfer2013-06-191-0/+25
| | | | | | | | | | | | | | | | | | Right now, setting up a pathspec to be parsed and processed requires several data structures and a couple of API calls. This adds a new high level data structure that contains all the items that you'll need and high-level APIs that do all of the setup and all of the teardown. This will make it easier to use pathspecs in various places with less repeated code.
* | Fix trailing whitespacesnulltoken2013-05-151-1/+1
|/
* Notify '*' pathspec correctly when diffingyorah2013-04-111-10/+15
| | | | I also moved all tests related to notifying in their own file.
* Return the matched pathspec pattern in `git_pathspec_match_path`yorah2013-02-071-3/+14
| | | | | | | Instead of returning directly the pattern as the return value, I used an out parameter, because the function also tests if the passed pathspecs vector is empty. If yes, it considers that the path "matches", but in that case there is no matched pattern per se.
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* Consolidate text buffer functionsRussell Belfer2012-11-281-2/+3
| | | | | | | | | | | | | There are many scattered functions that look into the contents of buffers to do various text manipulations (such as escaping or unescaping data, calculating text stats, guessing if content is binary, etc). This groups all those functions together into a new file and converts the code to use that. This has two enhancements to existing functionality. The old text stats function is significantly rewritten and the BOM detection code was extended (although largely we can't deal with anything other than a UTF8 BOM).
* Create internal strcmp variants for function ptrsRussell Belfer2012-11-141-4/+4
| | | | | | Using the builtin strcmp and strcasecmp as function pointers is problematic on win32. This adds internal implementations and divorces us from the platform linkage.
* Move pathspec code in separate filesRussell Belfer2012-11-091-0/+151
Diff uses a `git_strarray` of path specs to represent a subset of all files to be processed. It is useful to be able to reuse this filtering in other places outside diff, so I've moved it into a standalone set of utilities.