Commit Graph

56 Commits

Author SHA1 Message Date
Michael Boulton 6dc7641069
Make apply callback types have more conssitent names 2020-08-18 08:11:15 +01:00
Michael Boulton 37e56c28a8
Remove C wrapper for initialising apply opptions 2020-08-17 08:36:12 +01:00
Michael Boulton 7f3d112fbe
Make it possible to use a git2go error as a return value from a diff callback and have it propagate 2020-08-17 08:20:41 +01:00
Michael Boulton fff6c9d8ae
Store pointer to apply options instead of copying the struct 2020-08-17 08:17:58 +01:00
Michael Boulton d8f155f971
Convert diff contents to CBuffer and free it instead of using a CString 2020-08-17 08:15:56 +01:00
Michael Boulton 97267d3f6e
Remove uneeded locking of os thread in calling local C function 2020-08-17 08:07:06 +01:00
Michael Boulton 067989fe99
Fix some missing keepalives 2020-08-17 08:05:44 +01:00
Michael Boulton ad65e109e4
Do not embed callbacks in struct and give them more appropriate type names 2020-08-17 08:02:18 +01:00
Michael Boulton 887d2d9eeb
Fix missing extern 2020-08-14 09:18:48 +01:00
Michael Boulton 1352980b36
Add support for callback on hunks/apply 2020-08-14 09:17:13 +01:00
Michael Boulton de24abbdae
Add functionality for converting Diff objects to a buffer and back 2020-08-14 08:30:14 +01:00
lhchavez c78ae57de6
Fix a potential use-after-free in DiffNotifyCallback (#579)
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-06-21 06:45:39 -07:00
Suhaib Mujahid cf6522c7fe refactor: Rename methods with Get prefix
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 <lhchavez@users.noreply.github.com>
2020-05-09 23:32:17 -04:00
lhchavez 93c4c5b30a Fix the DiffFlag type
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-23 15:32:29 -08:00
lhchavez 11506ab070
Merge pull request #523 from josharian/diff-stringers
make Delta and DiffLineType stringers
2020-02-12 17:03:52 -08:00
Josh Bleecher Snyder 79b2cb6ca1 provide param names in DiffForEachFileCallback
Without a parameter name, the float64 param is pretty inscrutable.
2019-08-27 10:23:37 -07:00
Josh Bleecher Snyder 3849c7f52a make Delta and DiffLineType stringers 2019-08-27 10:02:12 -07:00
Segev Finer ad02c37e6d Add Diff.ToBuf wrapping git_diff_to_buf 2019-05-29 18:00:16 +03:00
Carlos Martín Nieto 538a05d55c Remove uses of deprecated git_buf_free 2018-08-08 11:51:51 +02:00
Carlos Martín Nieto a38a8e8ede diff: add two missing options 2018-01-17 11:47:06 +00:00
Carlos Martín Nieto 7d29d68644 Second round of keep-alives 2017-07-08 11:38:19 +02:00
Carlos Martín Nieto aadd0c2035 Merge remote-tracking branch 'upstream/master' into next 2016-08-27 21:07:44 +02:00
Travis Lane 981538924c diff: Add DiffStats String
This implements git_diff_stats_to_buf which provides the output for
git diff --stats.
2016-06-19 15:19:39 -07:00
Hans Rødtang 094bb3767b Add unimplemented diff delta/flag values. 2016-03-29 20:41:46 +02:00
Hans Rødtang 1e8b7ef380 Add "Conflicted" git.Delta and git.Status. 2016-03-29 20:37:22 +02:00
Hiroshi Ioka 975228d55c add DiffTreeToIndex
This is equivalent to `git diff --cached <treeish` or `diff --cached`.
2016-03-11 02:25:33 +09:00
Han-Wen Nienhuys aa59dccea7 Upgrade to libgit2 to 0f9d15493d5d8ad4353dd7beed52c9567334f6e5 2016-02-17 18:23:52 +01:00
Carlos Martín Nieto e066d24efb Add DiffBlobs
This lets you diff two arbitrary blobs with arbitrary names.
2015-06-29 21:29:47 +02:00
Carlos Martín Nieto 86e9917919 diff: remove unnecessary args to Hunk and Line ctors 2015-06-29 21:29:47 +02:00
Patrick Steinhardt e8531dd5c3 diff: only untrack notify payload when it is set 2015-05-22 10:01:50 +02:00
Patrick Steinhardt fe902f56a8 diff: use HandleList for C function callbacks. 2015-05-22 09:02:24 +02:00
Mark Probst 524cc7967b Add DiffIndexToWorkdir 2015-03-23 12:02:17 -07:00
Mark Probst 8622831b11 Add DiffTreeToWorkdirWithIndex 2015-03-23 12:02:17 -07:00
Henning Perl 18aea4bfe8 Add git_diff_get_stats()
This commit adds git_diff_get_stats() as well as functions to query the
stats for insertions, deletions, and changed files.
2015-01-04 12:13:46 +00:00
Quinn Slack d2a9d7768b heed DiffOptions fields OldPrefix and NewPrefix 2014-12-30 02:03:20 -08:00
Jose Alvarez db17135a30 Export PatchFromBuffers function.
This change also factor out diffOptionsToC function to remove
duplicated code.
2014-12-06 16:29:25 -05:00
Carlos Martín Nieto 520a0425c7 Add the newer missing thread-locking instances 2014-12-06 03:03:26 +01:00
Carlos Martín Nieto 8c631b0c25 Add missing thread locking 2014-12-06 02:45:26 +01:00
Carlos Martín Nieto 855d8790c4 Merge pull request #141 from jochil/git_diff_find_similar
Integrated git_diff_find_similar
2014-12-06 02:29:02 +01:00
Carlos Martín Nieto 1d759e3697 Update to master 2014-12-03 17:26:55 +01:00
Jochen Hilgers a4ae68783d Integrated git_diff_find_similar 2014-11-26 17:22:15 +01:00
joseferminj 1ba38905d1 Expose DiffTreeToWorkdir function 2014-11-13 23:06:45 -05:00
Carlos Martín Nieto 668aa5dae1 Make the constants have types
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-10-28 11:29:31 +01:00
Jesse Ezell 63fd1f9b03 use cast_ptr instead of ptr for travis go tip build 2014-04-04 09:42:17 -07:00
Jesse Ezell 4553b3ada6 fix go 1.0 compile error 2014-03-26 12:20:54 -07:00
Jesse Ezell 155f641683 don't expose 3 different diff foreach methods. use structures instead of pointers to structures for diff detail. add patch error code handling. trim excess data from diff structures. 2014-03-21 22:51:38 -07:00
Jesse Ezell f85c38ce22 Allow diff.ForEach to enumerate files, hunks, and lines with single call. Support use of closures for enumeration. 2014-03-21 17:20:48 -07:00
Jesse Ezell aea899e877 set ptr to nil after free 2014-03-20 23:19:22 -07:00
Jesse Ezell d78036fe24 refactor and cleanup code 2014-03-20 22:54:18 -07:00
Jesse Ezell d0b334b244 cleanup and refactor diff / patch 2014-03-20 21:56:41 -07:00