src/pathspec.c


Log

Author Commit Date CI Message
Russell Belfer 2b672d5b 2013-07-08T22:46:36 Add git_pathspec_match_diff API 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.
Russell Belfer a8b5f116 2013-07-03T17:00:50 Fix example/log.c pathspec handling of merges 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.
Russell Belfer d2ce27dd 2013-06-24T23:16:06 Add public API for pathspec matching 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.
Russell Belfer e91f9a8f 2013-06-19T15:20:59 Add higher level pathspec API 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.
nulltoken 1fed6b07 2013-05-13T21:57:37 Fix trailing whitespaces
yorah 0d32f39e 2013-03-04T11:31:50 Notify '*' pathspec correctly when diffing I also moved all tests related to notifying in their own file.
yorah 943700ec 2013-01-18T16:37:13 Return the matched pathspec pattern in `git_pathspec_match_path` 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.
Edward Thomson 359fc2d2 2013-01-08T17:07:25 update copyrights
Russell Belfer 7bf87ab6 2012-11-28T09:58:48 Consolidate text buffer functions 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).
Russell Belfer a277345e 2012-11-14T22:37:13 Create internal strcmp variants for function ptrs Using the builtin strcmp and strcasecmp as function pointers is problematic on win32. This adds internal implementations and divorces us from the platform linkage.
Russell Belfer 2e3d4b96 2012-11-08T16:47:28 Move pathspec code in separate files 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.