summaryrefslogtreecommitdiff
path: root/include/git2/diff.h
Commit message (Collapse)AuthorAgeFilesLines
...
* Update some documentationCarlos Martín Nieto2014-10-181-2/+2
|
* Join typedef and struct definitions in single file.Ciro Santilli2014-09-241-6/+4
|
* Move the UNREADABLE enums to the correct group.Alan Rogers2014-07-221-6/+6
|
* Merge remote-tracking branch 'origin/development' into ↵Alan Rogers2014-06-041-30/+30
|\ | | | | | | | | | | | | fix-git-status-list-new-unreadable-folder Conflicts: include/git2/diff.h
| * Formatting fixes for the docsCarlos Martín Nieto2014-06-031-29/+29
| | | | | | | | | | These are some issues I found while playing around with the new parser for docurium.
* | GIT_DIFF_INCLUDE_UNREADABLE_AS_UNTRACKEDAlan Rogers2014-06-031-1/+4
| |
* | Start adding GIT_DELTA_UNREADABLE and GIT_STATUS_WT_UNREADABLE.Alan Rogers2014-05-201-0/+4
|/
* Make init_options fns use unsigned ints and macroRussell Belfer2014-05-021-22/+22
| | | | | Use an unsigned int for the version and add a helper macro so the code is simplified (and so the error message is a common string).
* Remove trace / add git_diff_perfdata struct + apiRussell Belfer2014-05-021-16/+14
|
* Get rid of redundant git_diff_options_init fnRussell Belfer2014-05-021-17/+0
| | | | Since git_diff_init_options was introduced, remove this old fn.
* Add diff option to update index stat cacheRussell Belfer2014-05-021-0/+7
| | | | | | | | | | When diff is scanning the working directory, if it finds a file where it is not sure if the index entry matches the working dir, it will recalculate the OID (which is pretty expensive). This adds a new flag to diff so that if the OID calculation finds that the file actually has not changed (i.e. just the modified time was altered or such), then it will refresh the stat cache in the index so that future calls to diff will not have to check the oid again.
* Merge pull request #2291 from ethomson/patch_binaryVicent Marti2014-04-231-0/+4
|\ | | | | patch: emit deflated binary patches (optionally)
| * patch: emit binary patches (optionally)Edward Thomson2014-04-221-0/+4
| |
* | Use git_diff_get_stats in example/diff + refactorRussell Belfer2014-04-221-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This takes the `--stat` and related example options in the example diff.c program and converts them to use the `git_diff_get_stats` API which nicely formats stats for you. I went to add bar-graph scaling to the stats formatter and noticed that the `git_diff_stats` structure was holding on to all of the `git_patch` objects. Unfortunately, each of these objects keeps the full text of the diff in memory, so this is very expensive. I ended up modifying `git_diff_stats` to keep just the data that it needs to keep and allowed it to release the patches. Then, I added width scaling to the output on top of that. In making the diff example program match 'git diff' output, I ended up removing an newline from the sumamry output which I then had to compensate for in the email formatting to match the expectations. Lastly, I went through and refactored the tests to use a couple of helper functions and reduce the overall amount of code there.
* | Some doc and examples/diff.c changesRussell Belfer2014-04-221-18/+11
|/ | | | | | | | | | | | | | I was playing with "git diff-index" and wanted to be able to emulate that behavior a little more closely with the diff example. Also, I wanted to play with running `git_diff_tree_to_workdir` directly even though core Git doesn't exactly have the equivalent, so I added a command line option for that and tweaked some other things in the example code. This changes a minor output thing in that the "raw" print helper function will no longer add ellipses (...) if the OID is not actually abbreviated.
* Introduce git_diff_format_email and git_diff_commit_as_emailJacques Germishuys2014-04-151-0/+88
|
* Introduce git_diff_get_stats, git_diff_stats_files_changed, ↵Jacques Germishuys2014-04-151-0/+85
| | | | git_diff_stats_insertions, git_diff_stats_deletions and git_diff_stats_to_buf
* Added function-based initializers for every options struct.Matthew Bowen2014-03-051-0/+26
| | | | The basic structure of each function is courtesy of arrbee.
* Add buffer to buffer diff and patch APIsRussell Belfer2014-02-271-0/+33
| | | | | | | | This adds `git_diff_buffers` and `git_patch_from_buffers`. This also includes a bunch of internal refactoring to increase the shared code between these functions and the blob-to-blob and blob-to-buffer APIs, as well as some higher level assert helpers in the tests to also remove redundancy.
* diff: change id abbrev option's name to id_abbrevCarlos Martín Nieto2014-01-251-1/+1
| | | | | Same as the other commits in the series, we use 'id' when talking about thing rather than the datatype.
* diff: rename the file's 'oid' to 'id'Carlos Martín Nieto2014-01-251-2/+2
| | | | In the same vein as the previous commits in this series.
* Update docs for new callback return value behaviorRussell Belfer2013-12-111-6/+6
|
* Add config read fns with controlled error behaviorRussell Belfer2013-12-111-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | This adds `git_config__lookup_entry` which will look up a key in a config and return either the entry or NULL if the key was not present. Optionally, it can either suppress all errors or can return them (although not finding the key is not an error for this function). Unlike other accessors, this does not normalize the config key string, so it must only be used when the key is known to be in normalized form (i.e. all lower-case before the first dot and after the last dot, with no invalid characters). This also adds three high-level helper functions to look up config values with no errors and a fallback value. The three functions are for string, bool, and int values, and will resort to the fallback value for any error that arises. They are: * `git_config__get_string_force` * `git_config__get_bool_force` * `git_config__get_int_force` None of them normalize the config `key` either, so they can only be used for internal cases where the key is known to be in normal format.
* Clarify docsBen Straub2013-12-061-3/+3
|
* Clarify default value and behaviorBen Straub2013-12-061-1/+5
|
* Introduce GIT_DIFF_FIND_BY_CONFIGBen Straub2013-12-051-0/+3
|
* GIT_DIFF_FIND_REMOVE_UNMODIFIED sounds betterRussell Belfer2013-12-021-2/+2
|
* Add GIT_DIFF_FIND_DELETE_UNMODIFIED flagRussell Belfer2013-12-021-14/+44
| | | | | | | | | | When doing copy detection, it is often necessary to include UNMODIFIED records in the git_diff so they are available as source records for GIT_DIFF_FIND_COPIES_FROM_UNMODIFIED. Yet in the final diff, often you will not want to have these UNMODIFIED records. This adds a flag which marks these UNMODIFIED records for deletion from the diff list so they will be removed after the rename detect phase is over.
* Add content offset to git_diff_lineNick Hengeveld2013-11-181-0/+1
| | | | | | For additions and deletions, external consumers like subversion can make use of the content offset to generate diffs in their proprietary formats.
* Add git_diff_options_init helperRussell Belfer2013-11-011-4/+26
| | | | | | | | | Sometimes the static initializer for git_diff_options cannot be used and since setting them to all zeroes doesn't actually work quite right, this adds a new helper for that situation. This also adds an explicit new value to the submodule settings options to be used when those enums need static initialization.
* Make diff and status perform soft index reloadRussell Belfer2013-11-011-0/+8
| | | | | | | | | | | | | | | | | | | | | This changes `git_index_read` to have two modes - a hard index reload that always resets the index to match the on-disk data (which was the old behavior) and a soft index reload that uses the timestamp / file size information and only replaces the index data if the file on disk has been modified. This then updates the git_status code to do a soft reload unless the new GIT_STATUS_OPT_NO_REFRESH flag is passed in. This also changes the behavior of the git_diff functions that use the index so that when an index is not explicitly passed in (i.e. when the functions call git_repository_index for you), they will also do a soft reload for you. This intentionally breaks the file signature of git_index_read because there has been some confusion about the behavior previously and it seems like all existing uses of the API should probably be examined to select the desired behavior.
* Fix typoRussell Belfer2013-10-221-1/+1
|
* Implement patience and minimal diff flagsRussell Belfer2013-10-211-1/+4
| | | | | | It seems that to implement these options, we just have to pass the appropriate flags through to the libxdiff code taken from core git. So let's do it (and add a test).
* Create git_diff_line and extend git_diff_hunkRussell Belfer2013-10-211-10/+21
| | | | | | | | | | | | | Instead of having functions with so very many parameters to pass hunk and line data, this takes the existing git_diff_hunk struct and extends it with more hunk data, plus adds a git_diff_line. Those structs are used to pass back hunk and line data instead of the old APIs that took tons of parameters. Some work that was previously only being done for git_diff_patch creation (scanning the diff content for exact line counts) is now done for all callbacks, but the performance difference should not be noticable.
* Tweak to git_diff_delta structure for nfilesRussell Belfer2013-10-211-2/+3
| | | | | | While the base git_diff_delta structure always contains two files, when we introduce conflict data, it will be helpful to have an indicator when an additional file is involved.
* Diff API cleanupRussell Belfer2013-10-151-183/+225
| | | | | | | | This lays groundwork for separating formatting options from diff creation options. This groups the formatting flags separately from the diff list creation flags and reorders the options. This also tweaks some APIs to further separate code that uses patches from code that just looks at git_diffs.
* Rename diff objects and split patch.hRussell Belfer2013-10-111-309/+71
| | | | | | 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.
* Split rewrites, status doesn't return rewritesEdward Thomson2013-08-281-0/+3
| | | | | | | | Ensure that we apply splits to rewrites, even if we're not interested in examining it closely for rename/copy detection. In keeping with core git, status should not display rewrites, it should simply show files as "modified".
* Restore GIT_DIFF_LINE_BINARY usageRussell Belfer2013-07-231-1/+1
| | | | | | This restores the usage of GIT_DIFF_LINE_BINARY for the diff output line that reads "Binary files x and y differ" so that it can be optionally colorized independently of the file header.
* Add hunk/file headers to git_diff_patch_sizeRussell Belfer2013-07-231-2/+6
| | | | | | | | | | | This allows git_diff_patch_size to account for hunk headers and file headers in the returned size. This required some refactoring of the code that is used to print file headers so that it could be invoked by the git_diff_patch_size API. Also this increases the test coverage and fixes an off-by-one bug in the size calculation when newline changes happen at the end of the file.
* Add git_diff_patch_size() APIRussell Belfer2013-07-221-0/+18
| | | | | This adds a new API to get the size in bytes of the diffs in a git_diff_patch object.
* Add ignore_submodules to diff optionsRussell Belfer2013-07-101-1/+4
| | | | | | | | | | | | | | | | | | | | This adds correct support for an equivalent to --ignore-submodules in diff, where an actual ignore value can be passed to diff to override the per submodule settings in the configuration. This required tweaking the constants for ignore values so that zero would not be used and could represent an unset option to the diff. This was an opportunity to move the submodule values into include/git2/types.h and to rename the poorly named DEFAULT values for ignore and update constants to RESET instead. Now the GIT_DIFF_IGNORE_SUBMODULES flag is exactly the same as setting the ignore_submodules option to GIT_SUBMODULE_IGNORE_ALL (which is actually a minor change from the old behavior in that submodules will now be treated as UNMODIFIED deltas instead of being left out totally - if you set GIT_DIFF_INCLUDE_UNMODIFIED). This includes tests for the various new settings.
* Add git_pathspec_match_diff APIRussell Belfer2013-07-101-0/+8
| | | | | | | | | | | | | | | | | | 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.
* Fixed most documentation header bugsAndreas Linde2013-06-241-5/+5
| | | | | | | | | | | Fixed a few header @param and @return typos with the help of -Wdocumentation in Xcode. The following warnings have not been fixed: common.h:213 - Not sure how the documentation format is for '...' notes.h:102 - Correct @param name but empty text notes.h:111 - Correct @param name but empty text pack.h:140 - @return missing text pack.h:148 - @return missing text
* Add "as_path" parameters to blob and buffer diffsRussell Belfer2013-06-171-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | This adds parameters to the four functions that allow for blob-to- blob and blob-to-buffer differencing (either via callbacks or by making a git_diff_patch object). These parameters let you say that filename we should pretend the blob has while doing the diff. If you pass NULL, there should be no change from the existing behavior, which is to skip using attributes for file type checks and just look at content. With the parameters, you can plug into the new diff driver functionality and get binary or non-binary behavior, plus function context regular expressions, etc. This commit also fixes things so that the git_diff_delta that is generated by these functions will actually be populated with the data that we know about the blobs (or buffers) so you can use it appropriately. It also fixes a bug in generating patches from the git_diff_patch objects created via these functions. Lastly, there is one other behavior change that may matter. If there is no difference between the two blobs, these functions no longer generate any diff callbacks / patches unless you have passed in GIT_DIFF_INCLUDE_UNMODIFIED. This is pretty natural, but could potentially change the behavior of existing usage.
* Add patch from blobs APIRussell Belfer2013-06-121-2/+45
| | | | | | | | This adds two new public APIs: git_diff_patch_from_blobs and git_diff_patch_from_blob_and_buffer, plus it refactors the code for git_diff_blobs and git_diff_blob_to_buffer so that they code is almost entirely shared between these APIs, and adds tests for the new APIs.
* Implement regex pattern diff driverRussell Belfer2013-06-111-0/+3
| | | | | | | This implements the loading of regular expression pattern lists for diff drivers that search for function context in that way. This also changes the way that diff drivers update options and interface with xdiff APIs to make them a little more flexible.
* Clarify GIT_DIFF_INCLUDE_UNTRACKED_CONTENT optionRussell Belfer2013-05-241-5/+10
| | | | | | | | This improves the docs for GIT_DIFF_INCLUDE_UNTRACKED_CONTENT as well as the other flags related to UNTRACKED items in diff, plus it makes that flag now automatically turn on GIT_DIFF_INCLUDE_UNTRACKED which seems like a reasonable dwim type of change.
* More diff rename tests; better split swap handlingRussell Belfer2013-05-231-1/+1
| | | | | | | | | | | | | This adds a couple more tests of different rename scenarios. Also, this fixes a problem with the case where you have two "split" deltas and the left half of one matches the right half of the other. That case was already being handled, but in the wrong order in a way that could result in bad output. Also, if the swap also happened to put the other two halves into the correct place (i.e. two files exchanged places with each other), then the second delta was left with the SPLIT flag set when it really should be cleared.
* Significant rename detection rewriteRussell Belfer2013-05-221-6/+9
| | | | | | | | | | | | | | | | | | | | This flips rename detection around so instead of creating a forward mapping from deltas to possible rename targets, instead it creates a reverse mapping, looking at possible targets and trying to find a source that they could have been renamed or copied from. This is important because each output can only have a single source, but a given source could map to multiple outputs (in the form of COPIED records). Additionally, this makes a couple of tweaks to the public rename detection APIs, mostly renaming a couple of options that control the behavior to make more sense and to be more like core Git. I walked through the tests looking at the exact results and updated the expectations based on what I saw. The new code is different from the old because it cannot give some nonsense results (like A was renamed to both B and C) which were part of the outputs previously.