summaryrefslogtreecommitdiff
path: root/include/git2/diff.h
Commit message (Collapse)AuthorAgeFilesLines
...
* Move diff max_size to public APIRussell Belfer2012-09-101-1/+8
| | | | | | | | | | | This commit adds a max_size value in the public `git_diff_options` structure so that the user can automatically flag blobs over a certain size as binary regardless of other properties. Also, and perhaps more importantly, this moves binary detection to be as early as possible in the diff traversal inner loop and makes sure that we stop loading objects as soon as we decide that they are binary.
* Replace git_diff_iterator_num_files with progressRussell Belfer2012-09-101-17/+7
| | | | | | | | | The `git_diff_iterator_num_files` API was problematic, since we don't actually know the exact number of files to be iterated over until we load those files into memory. This replaces it with a new `git_diff_iterator_progress` API that goes from 0 to 1, and moves and renamed the old API for the internal places that can tolerate a max value instead of an exact value.
* Better header commentsRussell Belfer2012-09-061-24/+34
|
* diff: Cleanup documentation and printf compatVicent Marti2012-09-061-1/+12
|
* Fix comments and a minor bugRussell Belfer2012-09-051-34/+100
| | | | | This adds better header comments and also fixes a bug in one of simple APIs that tells the number of lines in the current hunk.
* Diff iteratorsRussell Belfer2012-09-051-1/+60
| | | | | | | | | | | This refactors the diff output code so that an iterator object can be used to traverse and generate the diffs, instead of just the `foreach()` style with callbacks. The code has been rearranged so that the two styles can still share most functions. This also replaces `GIT_REVWALKOVER` with `GIT_ITEROVER` and uses that as a common error code for marking the end of iteration when using a iterator style of object.
* Working implementation of git_submodule_statusRussell Belfer2012-08-241-0/+15
| | | | | | | | | | | | | This is a big redesign of the git_submodule_status API and the implementation of the redesigned API. It also fixes a number of bugs that I found in other parts of the submodule API while writing the tests for the status part. This also fixes a couple of bugs in the iterators that had not been noticed before - one with iterating when there is a gitlink (i.e. separate-work-dir) and one where I was treating anything even vaguely submodule-like as a submodule, more aggressively than core git does.
* Update iterators for consistency across libraryRussell Belfer2012-08-031-0/+18
| | | | | | | | | | | | | | | | | This updates all the `foreach()` type functions across the library that take callbacks from the user to have a consistent behavior. The rules are: * A callback terminates the loop by returning any non-zero value * Once the callback returns non-zero, it will not be called again (i.e. the loop stops all iteration regardless of state) * If the callback returns non-zero, the parent fn returns GIT_EUSER * Although the parent returns GIT_EUSER, no error will be set in the library and `giterr_last()` will return NULL if called. This commit makes those changes across the library and adds tests for most of the iteration APIs to make sure that they follow the above rules.
* Add flag to turn off pathspec testing for diff and statusyorah2012-07-241-0/+1
|
* diff: make inter-hunk-context default value git-compliantyorah2012-07-021-1/+1
| | | | Default in git core is 0, not 3
* Minor fixes, cleanups, and clarificationsRussell Belfer2012-06-081-22/+69
| | | | | | | | | | | | | | | | | | | | | | | There are three actual changes in this commit: 1. When the trailing newline of a file is removed in a diff, the change will now be reported with `GIT_DIFF_LINE_DEL_EOFNL` passed to the callback. Previously, the `ADD_EOFNL` constant was given which was just an error in my understanding of when the various circumstances arose. `GIT_DIFF_LINE_ADD_EOFNL` is deprecated and should never be generated. A new newline is simply an `ADD`. 2. Rewrote the `diff_delta__merge_like_cgit` function that contains the core logic of the `git_diff_merge` implementation. The new version doesn't actually have significantly different behavior, but the logic should be much more obvious, I think. 3. Fixed a bug in `git_diff_merge` where it freed a string pool while some of the string data was still in use. This led to `git_diff_print_patch` accessing memory that had been freed. The rest of this commit contains improved documentation in `diff.h` to make the behavior and the equivalencies with core git clearer, and a bunch of new tests to cover the various cases, oh and a minor simplification of `examples/diff.c`.
* misc: Fix warnings from PVS Studio trialVicent Martí2012-06-071-1/+1
|
* Fix spelling errors.Bruce Mitchener2012-05-191-1/+1
|
* diff: improve git_diff_blobs() documentationnulltoken2012-05-071-0/+8
|
* diff: make git_diff_blobs() able to detect binary blobsnulltoken2012-05-071-0/+1
|
* Merge branch 'new-error-handling' into developmentVicent Martí2012-05-021-21/+20
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .travis.yml include/git2/diff.h src/config_file.c src/diff.c src/diff_output.c src/mwindow.c src/path.c tests-clar/clar_helpers.c tests-clar/object/tree/frompath.c tests/t00-core.c tests/t03-objwrite.c tests/t08-tag.c tests/t10-refs.c tests/t12-repo.c tests/t18-status.c tests/test_helpers.c tests/test_main.c
| * Fix usage of "new" for fieldname in public headerRussell Belfer2012-05-021-16/+16
| | | | | | | | | | | | | | | | This should restore the ability to include libgit2 headers in C++ projects. Cherry picked 2de60205dfea2c4a422b2108a5e8605f97c2e895 from development into new-error-handling.
| * diff: provide more context to the consumer of the callbacksnulltoken2012-04-301-20/+17
| | | | | | | | Update the callback to provide some information related to the file change being processed and the range of the hunk, when applicable.
| * Fix crash in new status and add recurse optionRussell Belfer2012-03-231-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the bug that @nulltoken found (thank you!) where if there were untracked directories alphabetically after the last tracked item, the diff implementation would deref a NULL pointer. The fix involved the code which decides if it is necessary to recurse into a directory in the working dir, so it was easy to add a new option `GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS` to control if the contents of untracked directories should be included in status.
| * New status fixesRussell Belfer2012-03-221-1/+2
| | | | | | | | | | | | | | This adds support for roughly-right tracking of submodules (although it does not recurse into submodules to detect internal modifications a la core git), and it adds support for including unmodified files in diff iteration if requested.
* | diff_output: remove unused parameterschu2012-03-211-1/+0
| | | | | | | | Signed-off-by: schu <schu-github@schulog.org>
* | Fix usage of "new" for fieldname in public headerRussell Belfer2012-03-041-16/+16
|/ | | | | This should restore the ability to include libgit2 headers in C++ projects.
* Revert GIT_STATUS constants to avoid issuesRussell Belfer2012-03-021-1/+15
| | | | | | | | | This reverts the changes to the GIT_STATUS constants and adds a new enumeration to describe the type of change in a git_diff_delta. I don't love this solution, but it should prevent strange errors from occurring for now. Eventually, I would like to unify the various status constants, but it needs a larger plan and I just wanted to eliminate this breakage quickly.
* Update diff to use iteratorsRussell Belfer2012-03-021-21/+80
| | | | | | | | | | | | | 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.
* Continue implementation of git-diffRussell Belfer2012-03-021-9/+25
| | | | | | | | * Implemented git_diff_index_to_tree * Reworked git_diff_options structure to handle more options * Made most of the options in git_diff_options actually work * Reorganized code a bit to remove some redundancy * Added option parsing to examples/diff.c to test most options
* Clean up diff implementation for reviewRussell Belfer2012-03-021-22/+140
| | | | | | | This fixes several bugs, updates tests and docs, eliminates the FILE* assumption in favor of printing callbacks for the diff patch formatter helpers, and adds a "diff" example function that can perform a diff from the command line.
* Implement diff lists and formattersRussell Belfer2012-03-021-46/+91
| | | | | | | | This reworks the diff API to separate the steps of producing a diff descriptions from formatting the diff. This will allow us to share diff output code with the various diff creation scenarios and will allow us to implement rename detection as an optional pass that can be run on a diff list.
* Initial implementation of git_diff_blobRussell Belfer2012-03-021-0/+103
This gets the basic plumbing in place for git_diff_blob. There is a known issue where additional parameters like the number of lines of context to display on the diff are not working correctly (which leads one of the new unit tests to fail).