summaryrefslogtreecommitdiff
path: root/src/iterator.h
Commit message (Collapse)AuthorAgeFilesLines
...
* iterator: prevent git_iterator_free() from segfaulting when being passed a ↵nulltoken2012-05-131-0/+3
| | | | NULL iterator
* Add support for diffing index with no HEADRussell Belfer2012-05-081-0/+3
| | | | | | | When a repo is first created, there is no HEAD yet and attempting to diff files in the index was showing nothing because a tree iterator could not be constructed. This adds an "empty" iterator and falls back on that when the head cannot be looked up.
* Update diff to use iteratorsRussell Belfer2012-03-021-0/+6
| | | | | | | | | | | | | This is a major reorganization of the diff code. This changes the diff functions to use the iterators for traversing the content. This allowed a lot of code to be simplified. Also, this moved the functions relating to outputting a diff into a new file (diff_output.c). This includes a number of other changes - adding utility functions, extending iterators, etc. plus more tests for the diff code. This also takes the example diff.c program much further in terms of emulating git-diff command line options.
* Iterator improvements from diff implementationRussell Belfer2012-02-221-14/+19
| | | | | | | | | | | | | | | | | This makes two changes to iterator behavior: first, advance can optionally do the work of returning the new current value. This is such a common pattern that it really cleans up usage. Second, for workdir iterators, this removes automatically iterating into directories. That seemed like a good idea, but when an entirely new directory hierarchy is introduced into the workdir, there is no reason to iterate into it if there are no corresponding entries in the tree/index that it is being compared to. This second change actually wasn't a lot of code because not descending into directories was already the behavior for ignored directories. This just extends that to all directories.
* Uniform iterators for trees, index, and workdirRussell Belfer2012-02-211-0/+94
This create a new git_iterator type of object that provides a uniform interface for iterating over the index, an arbitrary tree, or the working directory of a repository. As part of this, git ignore support was extended to support push and pop of directory-based ignore files as the working directory is being traversed (so the array of ignores does not have to be recreated at each directory during traveral). There are a number of other small utility functions in buffer, path, vector, and fileops that are included in this patch that made the iterator implementation cleaner.