summaryrefslogtreecommitdiff
path: root/src/iterator.c
Commit message (Collapse)AuthorAgeFilesLines
* iterator: ignore submodule in has_endedEdward Thomson2016-04-211-4/+3
|
* iterator: support trailing `/` in start for submodEdward Thomson2016-04-021-10/+26
| | | | | | Allow callers to specify a start path with a trailing slash to match a submodule, instead of just a directory. This is for some legacy behavior that's sort of dumb, but there it is.
* Merge pull request #3719 from libgit2/ethomson/submodule_statusCarlos Martín Nieto2016-04-011-1/+1
|\ | | | | WD iterator: properly identify submodules
| * iterator: use correct search functionethomson/submodule_statusEdward Thomson2016-03-311-1/+1
| |
* | leaks: fix some iterator leaksEdward Thomson2016-03-311-6/+22
| |
* | Plug a few leaksCarlos Martín Nieto2016-03-311-0/+14
|/
* iterator: comment fixedMarc Strapetz2016-03-241-2/+2
|
* iterator: unused includes removedMarc Strapetz2016-03-241-4/+0
|
* iterator: cleanupsEdward Thomson2016-03-241-345/+48
| | | | Remove some unused functions, refactor some ugliness.
* iterator: refactor empty iterator to new styleEdward Thomson2016-03-241-15/+36
|
* iterator: mandate `advance_over`Edward Thomson2016-03-241-1/+10
| | | | | Since the three iterators implement `advance_over` differently, mandate it and implement each.
* iterator: refactor index iteratorEdward Thomson2016-03-241-200/+194
|
* iterator: move the index into the iterator itselfEdward Thomson2016-03-241-33/+8
|
* iterator: test that we're at the end of iterationEdward Thomson2016-03-231-1/+3
| | | | | | | Ensure that we have hit the end of iteration; previously we tested that we saw all the values that we expected to see. We did not then ensure that we were at the end of the iteration (and that there were subsequently values in the iteration that we did *not* expect.)
* iterator: combine fs+workdir iterators more completelyEdward Thomson2016-03-231-905/+1029
| | | | | | | | | | | | | Drop some of the layers of indirection between the workdir and the filesystem iterators. This makes the code a little bit easier to follow, and reduces the number of unnecessary allocations a bit as well. (Prior to this, when we filter entries, we would allocate them, filter them and then free them; now we do the filtering before allocation.) Also, rename `git_iterator_advance_over_with_status` to just `git_iterator_advance_over`. Mostly because it's a fucking long-ass function name otherwise.
* iterators: refactored tree iteratorEdward Thomson2016-03-231-391/+627
| | | | | | | | Refactored the tree iterator to never recurse; simply process the next entry in order in `advance`. Additionally, reduce the number of allocations and sorting as much as possible to provide a ~30% speedup on case-sensitive iteration. (The gains for case-insensitive iteration are less majestic.)
* git_object_dup: introduce typesafe versionsEdward Thomson2016-03-231-2/+2
|
* iterator: disambiguate reset and reset_rangeEdward Thomson2016-03-231-19/+50
| | | | | | Disambiguate the reset and reset_range functions. Now reset_range with a NULL path will clear the start or end; reset will leave the existing start and end unchanged.
* iterator: drop unused/unimplemented `seek`Edward Thomson2016-03-231-29/+0
|
* tree: re-use the id and filename in the odb objectCarlos Martín Nieto2016-03-201-2/+2
| | | | | Instead of copying over the data into the individual entries, point to the originals, which are already in a format we can use.
* Merge pull request #3619 from ethomson/win32_forbiddenCarlos Martín Nieto2016-02-181-3/+9
|\ | | | | win32: allow us to read indexes with forbidden paths on win32
| * iterator: assert tree_iterator has a frameEdward Thomson2016-02-171-7/+11
| | | | | | | | | | | | | | Although a `tree_iterator` that failed to be properly created does not have a frame, all other `tree_iterator`s should. Do not call `pop` in the failure case, but assert that in all other cases there is a frame.
| * Validate pointer before access the member.Colin Xu2016-02-171-3/+5
| | | | | | | | | | | | | | | | When Git repository at network locations, sometimes git_iterator_for_tree fails at iterator__update_ignore_case so it goes to git_iterator_free. Null pointer will crash the process if not check. Signed-off-by: Colin Xu <colin.xu@gmail.com>
* | Horrible fix for #3173.Arthur Schreiber2016-02-111-2/+3
|/
* pool: Simplify implementationVicent Marti2015-10-281-3/+4
|
* iterator: loop fs_iterator advance (don't recurse)Edward Thomson2015-09-131-35/+50
|
* iterator: advance the tree iterator smartlyEdward Thomson2015-09-111-42/+56
| | | | | | | | | | | | | | | | | | | | | | | | While advancing the tree iterator, if we advance over things that we aren't interested in, then call `current`. Which may *itself* call advance. While advancing the tree iterator, if we advance over things that we aren't interested in, then call `current`. Which may *itself* call advance. While advancing the tree iterator, if we advance over things that we aren't interested in, then call `current`. Which may *itself* call advance. While advancing the tree iterator, if we advance over things that we aren't interested in, then call `current`. Which may *itself* call advance. While advancing the tree iterator, if we advance over things that we aren't interested in, then call `current`. Which may *itself* call advance. Error: stack overflow.
* iterator: saner pathlist matching for idx iteratorEdward Thomson2015-08-311-62/+76
| | | | | | | | | | | | Some nicer refactoring for index iteration walks. The index iterator doesn't binary search through the pathlist space, since it lacks directory entries, and would have to binary search each index entry and all its parents (eg, when presented with an index entry of `foo/bar/file.c`, you would have to look in the pathlist for `foo/bar/file.c`, `foo/bar` and `foo`). Since the index entries and the pathlist are both nicely sorted, we walk the index entries in lockstep with the pathlist like we do for other iteration/diff/merge walks.
* tree_iterator: use a pathlistEdward Thomson2015-08-301-1/+34
|
* diff: use new iterator pathlist handlingEdward Thomson2015-08-301-106/+186
| | | | | | | | When using literal pathspecs in diff with `GIT_DIFF_DISABLE_PATHSPEC_MATCH` turn on the faster iterator pathlist handling. Updates iterator pathspecs to include directory prefixes (eg, `foo/`) for compatibility with `GIT_DIFF_DISABLE_PATHSPEC_MATCH`.
* iterator: sort subdirs properly with pathlistEdward Thomson2015-08-281-6/+15
| | | | | | | | | | When given a pathlist, don't assume that directories sort before files. Walk through any list of entries sorting before us to make sure that we've exhausted all entries that *aren't* directories. Eg, if we're searching for 'foo/bar', and we have a 'foo.c', keep advancing the pathlist to keep looking for an entry prefixed with 'foo/'.
* Move filelist into the iterator handling itself.Edward Thomson2015-08-281-8/+107
|
* iterator: use an options struct instead of argsEdward Thomson2015-08-281-25/+20
|
* errors: tighten up git_error_state OOMs a bit moreEdward Thomson2015-08-031-2/+2
| | | | | When an error state is an OOM, make sure that we treat is specially and do not try to free it.
* iterator: skip over errors in diriter initCarlos Martín Nieto2015-07-261-1/+4
| | | | | | | | | An error here will typically mean that the directory was removed between the time we iterated the parent and the time we wanted to visit it in which case we should ignore it. Other kinds of errors such as permissions (or transient errors) also better dealt with by pretending we didn't see it.
* iterator_walk: cast away constness for freeEdward Thomson2015-07-021-2/+2
|
* iterator_walk: drop unused variableEdward Thomson2015-06-291-5/+0
|
* index, iterator, fetchhead: plug leaksleaksCarlos Martín Nieto2015-06-261-0/+3
|
* iterator: provide git_iterator_walkEdward Thomson2015-06-251-0/+88
| | | | | Provide `git_iterator_walk` to walk each iterator in lockstep, returning each iterator's idea of the contents of the next path.
* diff: check files with the same or newer timestampsCarlos Martín Nieto2015-06-221-0/+12
| | | | | | | | | | When a file on the workdir has the same or a newer timestamp than the index, we need to perform a full check of the contents, as the update of the file may have happened just after we wrote the index. The iterator changes are such that we can reach inside the workdir iterator from the diff, though it may be better to have an accessor instead of moving these structs into the header.
* Merge pull request #3165 from ethomson/downcaseCarlos Martín Nieto2015-06-081-4/+4
|\ | | | | Downcase
| * git__tolower: a tolower() that isn't dumbEdward Thomson2015-05-291-4/+4
| | | | | | | | | | | | | | | | Some brain damaged tolower() implementations appear to want to take the locale into account, and this may require taking some insanely aggressive lock on the locale and slowing down what should be the most trivial of trivial calls for people who just want to downcase ASCII.
* | introduce `git_index_entry_is_conflict`Edward Thomson2015-05-281-1/+1
| | | | | | | | | | | | | | | | | | It's not always obvious the mapping between stage level and conflict-ness. More importantly, this can lead otherwise sane people to write constructs like `if (!git_index_entry_stage(entry))`, which (while technically correct) is unreadable. Provide a nice method to help avoid such messy thinking.
* | index iterator: optionally include conflictsEdward Thomson2015-05-281-7/+11
|/
* git_path_diriter: use FindFirstFile in win32Edward Thomson2015-05-011-1/+1
| | | | | | | Using FindFirstFile and FindNextFile in win32 allows us to use the directory information that is returned, instead of us having to get the file attributes all over again, which is a distinct cost savings on win32.
* git_path_diriter: next shouldn't take path ptrEdward Thomson2015-05-011-1/+1
| | | | | | | | The _next method shouldn't take a path pointer (and a path_len pointer) as 100% of current users use the full path and ignore the filename. Plus let's add some docs and a unit test.
* git_path_dirload_with_stat: moved to fs_iteratorEdward Thomson2015-05-011-7/+116
|
* git_win32_path_dirload_with_stat: removedEdward Thomson2015-05-011-16/+1
|
* Improvements to status performance on Windows.J Wyman2015-04-281-1/+17
| | | | Changed win32/path_w32.c to utilize NTFS' FindFirst..FindNext data instead of doing an lstat per file. Avoiding unnecessary directory opens and file scans reduces IO, improving overall performance. Effect is magnified due to NTFS being a kernel mode file system (as opposed to user mode).
* Improvements to ignore performance on Windows.J Wyman2015-04-281-5/+16
| | | | Minimizing the number directory and file opens, minimizes the amount of IO thus reducing the overall cost of performing ignore operations.