src/blame_git.c


Log

Author Commit Date CI Message
Patrick Steinhardt 21766702 2016-06-27T15:20:20 blame: do not decrement commit refcount in make_origin When we create a blame origin, we try to look up the blob that is to be blamed at a certain revision. When this lookup fails, e.g. because the file did not exist at that certain revision, we fail to create the blame origin and return `NULL`. The blame origin that we have just allocated is thereby free'd with `origin_decref`. The `origin_decref` function does not only decrement reference counts for the blame origin, though, but also for its commit and blob. When this is done in the error case, we will cause an uneven reference count for these objects. This may result in hard-to-debug failures at seemingly unrelated code paths, where we try to access these objects when they in fact have already been free'd. Fix the issue by refactoring `make_origin` such that we only allocate the object after the only function that may fail so that we do not have to call `origin_decref` at all. Also fix the `pass_blame` function, which indirectly calls `make_origin`, to free the commit when `make_origin` failed.
Patrick Steinhardt 8a4a343a 2016-03-10T16:33:49 blame_git: handle error returned by `git_commit_parent`
Patrick Steinhardt 944dbd12 2015-11-24T10:52:17 blame: use size_t for line counts in git_blame__entry The `git_blame__entry` struct keeps track of line counts with `int` fields. Since `int` is only guaranteed to be at least 16 bits we may overflow on certain platforms when line counts exceed 2^15. Fix this by instead storing line counts in `size_t`.
Edward Thomson ae195a71 2015-09-29T12:46:41 blame: guard xdiff calls for large files
Edward Thomson 234ca40a 2015-07-07T16:46:48 xdiff: upgrade to core git 2.4.5 Upgrade xdiff to version used in core git 2.4.5 (0df0541). Corrects an issue where an LF is added at EOF while applying an unrelated change (ba31180), cleans up some unused code (be89977 and e5b0662), and provides an improved callback to avoid leaking internal (to xdiff) structures (467d348). This also adds some additional functionality that we do not yet take advantage of, namely the ability to ignore changes whose lines are all blank (36617af).
Edward Thomson f1453c59 2015-02-12T12:19:37 Make our overflow check look more like gcc/clang's Make our overflow checking look more like gcc and clang's, so that we can substitute it out with the compiler instrinsics on platforms that support it. This means dropping the ability to pass `NULL` as an out parameter. As a result, the macros also get updated to reflect this as well.
Edward Thomson 392702ee 2015-02-09T23:41:13 allocations: test for overflow of requested size Introduce some helper macros to test integer overflow from arithmetic and set error message appropriately.
Juan Rubén 0276f0f5 2014-02-26T19:22:19 Reset num_parents to 1 only for merge commits Also, correct test case to account for the boundary flag
Juan Rubén c7c83394 2014-02-21T00:22:07 Add option to limit blame to first parent
Ben Straub aad5403f 2013-11-05T10:55:54 Fix MSVC 64-bit warnings
Ben Straub 7dcb1c45 2013-10-28T11:21:23 Adjust for diff API changes
Ben Straub a7d28f40 2013-10-28T05:22:37 :heart: bool
Ben Straub 49781a03 2013-09-25T14:40:19 Blame: minor cleanup
Ben Straub b6f60a4d 2013-09-21T22:02:23 Clean up ported code
Ben Straub 0a0f0558 2013-09-20T15:51:22 git_blame is a scoreboard
Ben Straub a121e580 2013-09-20T15:20:03 Add typedefs for internal structs
Ben Straub 25c47aae 2013-09-20T14:31:51 Detect boundaries, support limiting commit range
Ben Straub 0afe9996 2013-09-17T16:46:27 Check errors from libgit2 calls
Ben Straub ceab4e26 2013-09-16T16:20:38 Port blame from git.git