summaryrefslogtreecommitdiff
path: root/include/git2/diff.h
Commit message (Collapse)AuthorAgeFilesLines
* oid: `GIT_OID_*SZ` is now `GIT_OID_SHA1_*SIZE`Edward Thomson2022-06-141-1/+1
| | | | | In preparation for SHA256 support, `GIT_OID_RAWSZ` and `GIT_OID_HEXSZ` need to indicate that they're the size of _SHA1_ OIDs.
* diff: indicate when the file size is "valid"Edward Thomson2022-02-121-1/+2
| | | | | | | | When we know the file size (because we're producing it from a working directory iterator, or an index with an up-to-date cache) then set a flag indicating as such. This removes the ambiguity about a 0 file size, which could indicate that a file exists and is 0 bytes, or that we haven't read it yet.
* Merge pull request #6168 from punkymaniac/patch-documentation-2Edward Thomson2022-01-171-0/+7
|\ | | | | Improve documentation
| * Add documentation about parameter and return valuepunkymaniac2022-01-091-0/+7
| |
* | Fix typosDimitris Apostolou2022-01-051-2/+2
|/
* Make enum in includes C90 compliant by removing trailing comma.Peter Pettersson2021-11-151-7/+7
|
* diff: document updated rename limitethomson/diff_rename_limitEdward Thomson2021-10-131-1/+1
|
* diff: update `GIT_DIFF_IGNORE_BLANK_LINES`ethomson/diff_enumEdward Thomson2021-09-211-4/+3
| | | | | `GIT_DIFF_IGNORE_BLANK_LINES` needs to be within a (signed) int, per the `enum` definition of ISO C.
* diff: deprecate diff_format_emailethomson/emailEdward Thomson2021-09-181-93/+0
| | | | `git_diff_format_email` is deprecated in favor of `git_email_create`.
* Fix documentation formatting for git_diff_filepunkymaniac2021-07-061-19/+30
|
* diff:add option to ignore blank line changesyuuri2021-05-011-0/+4
|
* Fix diff_entrycount -> diff_num_deltas doc typoMarco Sirabella2021-04-121-1/+1
| | | | | This just fixes a typo in the documentation, actual rename change was done in 5f69a31f
* Merge pull request #5306 from herrerog/patchidPatrick Steinhardt2019-11-281-0/+1
|\ | | | | diff: complete support for git patchid
| * diff_print: add support for GIT_DIFF_FORMAT_PATCH_ID.Gregory Herrero2019-11-191-0/+1
| | | | | | | | | | | | | | Git is generating patch-id using a stripped down version of a patch where hunk header and index information are not present. Signed-off-by: Gregory Herrero <gregory.herrero@oracle.com>
* | blob: use `git_object_size_t` for object sizeEdward Thomson2019-11-221-6/+6
|/ | | | | Instead of using a signed type (`off_t`) use a new `git_object_size_t` for the sizes of objects.
* Don't use enum for flagsSven Strickroth2019-09-261-2/+3
| | | | | | Using an `enum` causes trouble when used with C++ as bitwise operations are not possible w/o casting (e.g., `opts.flags &= ~GIT_BLOB_FILTER_CHECK_FOR_BINARY;` is invalid as there is no `&=` operator for `enum`). Signed-off-by: Sven Strickroth <email@cs-ware.de>
* Rename opt init functions to `options_init`Edward Thomson2019-06-141-6/+6
| | | | | | | | | | | | | In libgit2 nomenclature, when we need to verb a direct object, we name a function `git_directobject_verb`. Thus, if we need to init an options structure named `git_foo_options`, then the name of the function that does that should be `git_foo_options_init`. The previous names of `git_foo_init_options` is close - it _sounds_ as if it's initializing the options of a `foo`, but in fact `git_foo_options` is its own noun that should be respected. Deprecate the old names; they'll now call directly to the new ones.
* Introduce GIT_CALLBACK macro to enforce cdeclEdward Thomson2019-01-171-10/+10
| | | | | | | | | Since we now always build the library with cdecl calling conventions, our callbacks should be decorated as such so that users will not be able to provide callbacks defined with other calling conventions. The `GIT_CALLBACK` macro will inject the `__cdecl` attribute as appropriate.
* diff: documentation mashupEtienne Samson2018-08-291-111/+151
|
* diff: fix enum value being out of allowed rangePatrick Steinhardt2018-06-121-6/+6
| | | | | | | | | | | | | | | | | | The C89 standard states in §6.7.2.2 "Enumeration specifiers": > The expression that defines the value of an enumeration constant shall > be an integer constant expression that has a value representable as an > int. On most platforms, this effectively limits the range to a 32 bit signed integer. The enum `git_diff_option_t` though recently gained an entry `GIT_DIFF_INDENT_HEURISTIC = (1u << 31)`, which breaks this limit. Fix the issue by using a gap in `git_diff_option_t`'s enum values. While this has the benefit of retaining our API, it may break applications which do not get recompiled after upgrading libgit2. But as we are bumping the soversion on each release anyway and thus force a recompile of dependents, this is not a problem.
* docs: standardize struct git_*_options commentsEtienne Samson2018-05-071-2/+3
|
* docs: standardize comment block for git_*_init_options functionsEtienne Samson2018-05-071-14/+23
|
* diff: ensure an unsigned number is shiftedJacques Germishuys2018-03-081-3/+3
|
* diff: expose the "indent heuristic" in the diff optionsCarlos Martín Nieto2017-11-191-0/+6
| | | | | We default to off, but we might want to consider changing `GIT_DIFF_NORMAL` to include it.
* Docs: Fix inline comments for git_diff_hunkAlpha2017-08-111-6/+6
|
* diff: implement function to calculate patch IDPatrick Steinhardt2017-06-261-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The upstream git project provides the ability to calculate a so-called patch ID. Quoting from git-patch-id(1): A "patch ID" is nothing but a sum of SHA-1 of the file diffs associated with a patch, with whitespace and line numbers ignored." Patch IDs can be used to identify two patches which are probably the same thing, e.g. when a patch has been cherry-picked to another branch. This commit implements a new function `git_diff_patchid`, which gets a patch and derives an OID from the diff. Note the different terminology here: a patch in libgit2 are the differences in a single file and a diff can contain multiple patches for different files. The implementation matches the upstream implementation and should derive the same OID for the same diff. In fact, some code has been directly derived from the upstream implementation. The upstream implementation has two different modes to calculate patch IDs, which is the stable and unstable mode. The old way of calculating the patch IDs was unstable in a sense that a different ordering the diffs was leading to different results. This oversight was fixed in git 1.9, but as git tries hard to never break existing workflows, the old and unstable way is still default. The newer and stable way does not care for ordering of the diff hunks, and in fact it is the mode that should probably be used today. So right now, we only implement the stable way of generating the patch ID.
* diff: treat binary patches with no data specialethomson/diff-read-empty-binaryEdward Thomson2016-09-051-0/+8
| | | | | | When creating and printing diffs, deal with binary deltas that have binary data specially, versus diffs that have a binary file but lack the actual binary data.
* diff: document `git_diff_from_buffer`ethomson/doc_diff_from_bufferEdward Thomson2016-08-051-0/+19
|
* git_diff_file: move `id_abbrev`ethomson/diff_fileEdward Thomson2016-08-031-6/+6
| | | | | Move `id_abbrev` to a more reasonable place where it packs more nicely (before anybody starts using it).
* Introduce `git_diff_to_buf`Edward Thomson2016-05-261-0/+15
| | | | | Like `git_patch_to_buf`, provide a simple helper method that can print an entire diff directory to a `git_buf`.
* introduce `git_diff_from_buffer` to parse diffsEdward Thomson2016-05-261-0/+5
| | | | Parse diff files into a `git_diff` structure.
* diff: include oid length in deltasEdward Thomson2016-05-261-1/+7
| | | | | | Now that `git_diff_delta` data can be produced by reading patch file data, which may have an abbreviated oid, allow consumers to know that the id is abbreviated.
* Patch parsing from patch filesEdward Thomson2016-05-261-6/+8
|
* Fix typoEphemera2016-02-051-1/+1
|
* diff: include commit message when formatting patchPatrick Steinhardt2015-12-011-1/+4
| | | | | | When formatting a patch as email we do not include the commit's message in the formatted patch output. Implement this and add a test that verifies behavior.
* Add diff progress callback.Jason Haslam2015-11-021-5/+24
|
* iterator: better document GIT_DIFF_DISABLE_PATHSPEC_MATCHEdward Thomson2015-08-311-4/+6
|
* diff: drop `FILELIST_MATCH`Edward Thomson2015-08-301-7/+0
| | | | | Now that non-pathspec matching diffs are implemented at the iterator level, drop `FILELIST_MATCH`ing.
* diff: better document GIT_DIFF_PATHSPEC_DISABLEEdward Thomson2015-08-281-1/+3
| | | | | | Document that `GIT_DIFF_PATHSPEC_DISABLE` is not necessarily about explicit path matching, but also includes matching of directory names. Enforce this in a test.
* Move filelist into the iterator handling itself.Edward Thomson2015-08-281-0/+7
|
* Added git_diff_index_to_index()Pierre-Olivier Latour2015-06-301-0/+19
|
* Rename FALLBACK to UNSPECIFIEDcmn/rename-unspecifiedCarlos Martín Nieto2015-06-251-1/+1
| | | | | Fallback describes the mechanism, while unspecified explains what the user is thinking.
* submodule: add an ignore option to statusCarlos Martín Nieto2015-06-221-1/+1
| | | | | | | | | | | | | This lets us specify in the status call which ignore rules we want to use (optionally falling back to whatever the submodule has in its configuration). This removes one of the reasons for having `_set_ignore()` set the value in-memory. We re-use the `IGNORE_RESET` value for this as it is no longer relevant but has a similar purpose to `IGNORE_FALLBACK`. Similarly, we remove `IGNORE_DEFAULT` which does not have use outside of initializers and move that to fall back to the configuration as well.
* diff: introduce binary diff callbacksEdward Thomson2015-06-121-0/+55
| | | | | | | Introduce a new binary diff callback to provide the actual binary delta contents to callers. Create this data from the diff contents (instead of directly from the ODB) to support binary diffs including the workdir, not just things coming out of the ODB.
* Introduce `GIT_DIFF_FLAG_EXISTS`Edward Thomson2015-05-281-0/+1
| | | | | | | | | | Mark the `old_file` and `new_file` sides of a delta with a new bit, `GIT_DIFF_FLAG_EXISTS`, that introduces that a particular side of the delta exists in the diff. This is useful for indicating whether a working directory item exists or not, in the presence of a conflict. Diff users may have previously used DELETED to determine this information.
* diff/status: introduce conflictsEdward Thomson2015-05-281-10/+11
| | | | | | | | | | | When diffing against an index, return a new `GIT_DELTA_CONFLICTED` delta type for items that are conflicted. For a single file path, only one delta will be produced (despite the fact that there are multiple entries in the index). Index iterators now have the (optional) ability to return conflicts in the index. Prior to this change, they would be omitted, and callers (like diff) would omit conflicted index entries entirely.
* checkout: break case-changes into delete/addEdward Thomson2015-05-041-1/+6
| | | | | | | When checking out with a case-insensitive working directory, we want to change the case of items in the working directory to reflect changes that occured in the checkout target. Diff now has an option to break case-changing renames into delete/add.
* diff docs: update `git_diff_delta` descriptionEdward Thomson2015-02-031-3/+3
|
* Changed context_lines and interhunk_lines to uint32_t to match struct ↵Pierre-Olivier Latour2014-10-271-2/+2
| | | | s_xdemitconf
* Update some documentationCarlos Martín Nieto2014-10-181-2/+2
|