Commit Graph

13 Commits

Author SHA1 Message Date
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
lye 9acd67e388 Actually type constants; unwrap DiffFile, DiffDelta, DiffHunk. 2014-02-26 16:02:26 -06:00
lye 45b0f17c04 Bundle consts more idiomatically; add GitLineType alias. 2014-02-26 05:58:45 -06:00
lye 2e5102b71a Unwrap DiffLine; add types for git_diff_flag_t and git_delta_t. 2014-02-26 04:36:04 -06:00
lye 48a02566d6 Pre-emptively copy data when marshalling diff callback data.
When marshalling diff callback data to Go structs, any `char*` need to
be pre-emptively copied onto Go's heap as they're invalidated as soon as
our callback function returns. This patch adds this extra copy before
sending the value to the channel, which fixes a bug wherein
`DiffLine.Content`, `DiffFile.Path` and `DiffHunk.Header` would
previously return garbage data.
2014-02-23 18:51:56 -06:00
lye 375168abdc Export the constants and enumerations for diffs.
It is possible that the typed enums from libgit2 should be exported as
distinct types rather than numeric constants (e.g, `git_delta_t` and
`git_line_t` should be typed), but this has not been done in this patch.
2014-02-23 18:06:04 -06:00
lye bc80beb843 Add partial diff/patch functionality.
This commit adds barebones capacity to generate diffs from two trees and
to emit those as git-style diffs (via `Patch.String`), or to enumerate
the files/hunks/lines in the diff to emit the data yourself.

The walk functions have been implemented in the same manner as the Odb
walking methods.

Note that not all of the functionality is implemented for either the
`git_diff_*` nor the `git_patch_*` functions, and there are unexposed
constants which would likely be useful to add.
2014-02-20 00:29:03 -06:00