summaryrefslogtreecommitdiff
path: root/diff.go
AgeCommit message (Collapse)Author
2021-09-05Make all non-user-creatable structures non-comparable (#802)lhchavez
This change makes all non-user-creatable structures non-comparable. This makes it easier to add changes later that don't introduce breaking changes from the go compatibility guarantees perspective. This, of course, implies that this change _is_ a breaking change, but since these structures are not intended to be created by users (or de-referenced), it should be okay.
2021-09-04Add DiffIgnoreWitespaceEol and deprecate DiffIgnoreWitespaceEol (#774)Gustav Westling
DiffIgnoreWitespaceEol contains a typo and does not have the same name as it's libgit2 counterpart. Fixes #773
2020-12-10More callback refactoring (#713)lhchavez
This change: * Gets rid of the `.toC()` functions for Options objects, since they were redundant with the `populateXxxOptions()`. * Adds support for `errorTarget` to the `RemoteOptions`, since they are used in the same stack for some functions (like `Fetch()`). Now for those cases, the error returned by the callback will be preserved as-is.
2020-12-05Refactor all callbacks (#700)lhchavez
This change is a preparation for another change that makes all callback types return a Go error instead of an error code / an integer. That is going to make make things a lot more idiomatic. The reason this change is split is threefold: a) This change is mostly mechanical and should contain no semantic changes. b) This change is backwards-compatible (in the Go API compatibility sense of the word), and thus can be backported to all other releases. c) It makes the other change a bit smaller and more focused on just one thing. Concretely, this change makes all callbacks populate a Go error when they fail. If the callback is invoked from the same stack as the function to which it was passed (e.g. for `Tree.Walk`), it will preserve the error object directly into a struct that also holds the callback function. Otherwise if the callback is pased to one func and will be invoked when run from another one (e.g. for `Repository.InitRebase`), the error string is saved into the libgit2 thread-local storage and then re-created as a `GitError`.
2020-12-05Mark some symbols to be deprecated #minor (#698)lhchavez
This change introduces the file deprecated.go, which contains any constants, functions, and types that are slated to be deprecated in the next major release. These symbols are deprecated because they refer to old spellings in pre-1.0 libgit2. This also makes the build be done with the `-DDEPRECATE_HARD` flag to avoid regressions. This, together with [gorelease](https://godoc.org/golang.org/x/exp/cmd/gorelease)[1] should make releases safer going forward. 1: More information about how that works at https://go.googlesource.com/exp/+/refs/heads/master/apidiff/README.md
2020-10-23apply: Add bindings for git_apply_to_tree (#657)Sami Hiltunen
Adds bindings to the git_apply_to_tree function that allows applying a diff directly to a tree.
2020-10-22refactor: Use undeprecated options init (#656)Suhaib Mujahid
This PR move form linking against the deprecated `init_options` functions to the renamed `options_init` functions. For more context see libgit2/libgit2@0b5ba0d744e69da5dc8c08d167c83dd87ed83af2 and libgit2/libgit2@c6184f0c4b209e462bf3f42ab20df2d13d8ee918.
2020-08-18More diff functionality (#629)michael boulton
This PR adds - The ability to apply a Diff object to the repo - Support for git_apply_hunk_cb and git_apply_delta_cb callbacks in options for applying the diffs - The ability to import a diff from a raw buffer (for example, one exported by ToBuf) into a Diff object associated with the repo - Tests for the above
2020-06-21Fix a potential use-after-free in DiffNotifyCallback (#579)lhchavez
This change makes the DiffNotifyCallback always use an "unowned" *git.Diff that does _not_ run the finalizer. Since the underlying git_diff object is still owned by libgit2, we shouldn't be calling Diff.Free() on it, even by accident, since that would cause a whole lot of undefined behavior. Now instead of storing a reference to a *git.Diff in the intermediate state while the diff operation is being done, create a brand new *git.Diff for every callback invocation, and only create a fully-owned *git.Diff when the diff operation is done and the ownership is transfered to Go.
2020-05-09refactor: Rename methods with Get prefixSuhaib Mujahid
It is not Go idiomatic to put Get into the getter's name. https: //golang.org/doc/effective_go.html#Getters Co-Authored-By: lhchavez <[email protected]>
2020-02-23Fix the DiffFlag typelhchavez
This change makes the underlying type of DiffFlag be uint32 instead of int. That makes it possible to build on 32-bit systems. Fixes: #487
2020-02-12Merge pull request #523 from josharian/diff-stringerslhchavez
make Delta and DiffLineType stringers
2019-08-27provide param names in DiffForEachFileCallbackJosh Bleecher Snyder
Without a parameter name, the float64 param is pretty inscrutable.
2019-08-27make Delta and DiffLineType stringersJosh Bleecher Snyder
2019-05-29Add Diff.ToBuf wrapping git_diff_to_bufSegev Finer
2018-08-08Remove uses of deprecated git_buf_freeCarlos Martín Nieto
2018-01-17diff: add two missing optionsCarlos Martín Nieto
2017-07-08Second round of keep-alivesCarlos Martín Nieto
2016-08-27Merge remote-tracking branch 'upstream/master' into nextCarlos Martín Nieto
2016-06-19diff: Add DiffStats StringTravis Lane
This implements git_diff_stats_to_buf which provides the output for git diff --stats.
2016-03-29Add unimplemented diff delta/flag values.Hans Rødtang
2016-03-29Add "Conflicted" git.Delta and git.Status.Hans Rødtang
2016-03-11add DiffTreeToIndexHiroshi Ioka
This is equivalent to `git diff --cached <treeish` or `diff --cached`.
2016-02-17Upgrade to libgit2 to 0f9d15493d5d8ad4353dd7beed52c9567334f6e5Han-Wen Nienhuys
2015-06-29Add DiffBlobsCarlos Martín Nieto
This lets you diff two arbitrary blobs with arbitrary names.
2015-06-29diff: remove unnecessary args to Hunk and Line ctorsCarlos Martín Nieto
2015-05-22diff: only untrack notify payload when it is setPatrick Steinhardt
2015-05-22diff: use HandleList for C function callbacks.Patrick Steinhardt
2015-03-23Add DiffIndexToWorkdirMark Probst
2015-03-23Add DiffTreeToWorkdirWithIndexMark Probst
2015-01-04Add git_diff_get_stats()Henning Perl
This commit adds git_diff_get_stats() as well as functions to query the stats for insertions, deletions, and changed files.
2014-12-30heed DiffOptions fields OldPrefix and NewPrefixQuinn Slack
2014-12-06Export PatchFromBuffers function.Jose Alvarez
This change also factor out diffOptionsToC function to remove duplicated code.
2014-12-06Add the newer missing thread-locking instancesCarlos Martín Nieto
2014-12-06Add missing thread lockingCarlos Martín Nieto
2014-12-06Merge pull request #141 from jochil/git_diff_find_similarCarlos Martín Nieto
Integrated git_diff_find_similar
2014-12-03Update to masterCarlos Martín Nieto
2014-11-26Integrated git_diff_find_similarJochen Hilgers
2014-11-13Expose DiffTreeToWorkdir functionjoseferminj
2014-10-28Make the constants have typesCarlos Martín Nieto
While Go will assign the correct type to a const block when it auto-creates the values, assigning makes the const be typeless and will only gain it in each particular use. Make each constant in the blocks have an assigned type.
2014-04-04use cast_ptr instead of ptr for travis go tip buildJesse Ezell
2014-03-26fix go 1.0 compile errorJesse Ezell
2014-03-21don't expose 3 different diff foreach methods. use structures instead of ↵Jesse Ezell
pointers to structures for diff detail. add patch error code handling. trim excess data from diff structures.
2014-03-21Allow diff.ForEach to enumerate files, hunks, and lines with single call. ↵Jesse Ezell
Support use of closures for enumeration.
2014-03-20set ptr to nil after freeJesse Ezell
2014-03-20refactor and cleanup codeJesse Ezell
2014-03-20cleanup and refactor diff / patchJesse Ezell
2014-02-26Actually type constants; unwrap DiffFile, DiffDelta, DiffHunk.lye
2014-02-26Bundle consts more idiomatically; add GitLineType alias.lye
2014-02-26Unwrap DiffLine; add types for git_diff_flag_t and git_delta_t.lye