src/blame.c


Log

Author Commit Date CI Message
punkymaniac 379c4646 2021-09-09T19:49:04 Fix coding style for pointer Make some syntax change to follow coding style.
panda b9bfe812 2021-03-03T14:03:06 Check git_signature_dup failure git_signature_dup can have an allocation failure
Edward Thomson efab78cd 2020-04-05T10:09:11 blame: use GIT_ASSERT
Patrick Steinhardt c6184f0c 2020-06-08T21:07:36 tree-wide: do not compile deprecated functions with hard deprecation When compiling libgit2 with -DDEPRECATE_HARD, we add a preprocessor definition `GIT_DEPRECATE_HARD` which causes the "git2/deprecated.h" header to be empty. As a result, no function declarations are made available to callers, but the implementations are still available to link against. This has the problem that function declarations also aren't visible to the implementations, meaning that the symbol's visibility will not be set up correctly. As a result, the resulting library may not expose those deprecated symbols at all on some platforms and thus cause linking errors. Fix the issue by conditionally compiling deprecated functions, only. While it becomes impossible to link against such a library in case one uses deprecated functions, distributors of libgit2 aren't expected to pass -DDEPRECATE_HARD anyway. Instead, users of libgit2 should manually define GIT_DEPRECATE_HARD to hide deprecated functions. Using "real" hard deprecation still makes sense in the context of CI to test we don't use deprecated symbols ourselves and in case a dependant uses libgit2 in a vendored way and knows it won't ever use any of the deprecated symbols anyway.
lhchavez 62d59467 2020-03-08T02:13:11 Fix segfault when calling git_blame_buffer() This change makes sure that the hunk is not null before trying to dereference it. This avoids segfaults, especially when blaming against a modified buffer (i.e. the index). Fixes: #5443
Edward Thomson 4dffa295 2019-06-23T18:09:00 blame: use a size_t for the buffer
Edward Thomson 5d92e547 2019-06-08T17:28:35 oid: `is_zero` instead of `iszero` The only function that is named `issomething` (without underscore) was `git_oid_iszero`. Rename it to `git_oid_is_zero` for consistency with the rest of the library.
Edward Thomson 0b5ba0d7 2019-06-06T16:36:23 Rename opt init functions to `options_init` 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.
Edward Thomson f4ebb2d4 2019-01-21T00:56:35 blame: make hunk_cmp handle unsigned differences
Edward Thomson f673e232 2018-12-27T13:47:34 git_error: use new names in internal APIs and usage Move to the `git_error` name in the internal API for error-related functions.
Edward Thomson 168fe39b 2018-11-28T14:26:57 object_type: use new enumeration names Use the new object_type enumeration names within the codebase.
Etienne Samson ca9bbcb5 2018-06-19T20:15:02 blame: check error code when loading the mailmap Reported by Coverity, CID 1393484
Nika Layzell 8ff0504d 2018-04-08T03:01:14 mailmap: Rewrite API to support accurate mailmap resolution
Nika Layzell 4ff44be8 2018-03-17T18:24:15 mailmap: Fix more bugs which snuck in when I rebased
Nika Layzell e3dcaca5 2018-03-17T18:15:01 mailmap: Integrate mailmaps with blame and signatures
Patrick Steinhardt 0c7f49dd 2017-06-30T13:39:01 Make sure to always include "common.h" first Next to including several files, our "common.h" header also declares various macros which are then used throughout the project. As such, we have to make sure to always include this file first in all implementation files. Otherwise, we might encounter problems or even silent behavioural differences due to macros or defines not being defined as they should be. So in fact, our header and implementation files should make sure to always include "common.h" first. This commit does so by establishing a common include pattern. Header files inside of "src" will now always include "common.h" as its first other file, separated by a newline from all the other includes to make it stand out as special. There are two cases for the implementation files. If they do have a matching header file, they will always include this one first, leading to "common.h" being transitively included as first file. If they do not have a matching header file, they instead include "common.h" as first file themselves. This fixes the outlined problems and will become our standard practice for header and source files inside of the "src/" from now on.
Patrick Steinhardt e850e98d 2016-03-10T16:42:55 blame: handle error when resoling HEAD in normalize_options When normalizing options we try to look up HEAD's OID. While this action may fail in malformed repositories we never check the return value of the function. Fix the issue by converting `normalize_options` to actually return an error and handle the error in `git_blame_file`.
Patrick Steinhardt cb1cb24c 2015-11-24T10:18:58 blame: use size_t for line counts in git_blame_hunk It is not unreasonable to have versioned files with a line count exceeding 2^16. Upon blaming such files we fail to correctly keep track of the lines as `git_blame_hunk` stores them in `uint16_t` fields. Fix this by converting the line fields of `git_blame_hunk` to `size_t`. Add test to verify behavior.
Edward Thomson ae195a71 2015-09-29T12:46:41 blame: guard xdiff calls for large files
Edward Thomson 8147b1af 2015-05-25T20:03:59 diff: introduce binary diff callbacks 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.
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.
Arkady Shapkin 5cd81bb3 2014-09-03T01:01:25 Several CppCat warnings fixed
Russell Belfer 702efc89 2014-04-30T10:57:42 Make init_options fns use unsigned ints and macro Use an unsigned int for the version and add a helper macro so the code is simplified (and so the error message is a common string).
Jiri Pospisil 79aa0302 2014-03-06T22:23:57 blame: Fix compare function's data types Previously the hunk_byfinalline_search_cmp function was called with different data types (size_t and uint32_t) for the key argument but expected only the former resulting in an invalid memory access when passed the latter on a 64 bit machine. The following patch makes sure that the function is called and works with the same type (size_t).
Matthew Bowen b9f81997 2014-03-05T21:49:23 Added function-based initializers for every options struct. The basic structure of each function is courtesy of arrbee.
Russell Belfer e9d5e5f3 2014-01-28T16:25:42 Some fixes for Windows x64 warnings
Arthur Schreiber 29be3a6d 2014-01-14T21:33:35 Align git_signature_dup. This changes git_signature_dup to actually honor oom conditions raised by the call to git__strdup. It also aligns it with the error code return pattern used everywhere else.
Arthur Schreiber b0b32b43 2014-01-13T22:51:10 Fix a double free issue in `git_blame__alloc`. `git_blame_free` already calls `git__free` on `gbr`.
XTao a06474f8 2014-01-08T11:19:12 Add orig_commit.
Russell Belfer 9cfce273 2013-12-12T12:11:38 Cleanups, renames, and leak fixes This renames git_vector_free_all to the better git_vector_free_deep and also contains a couple of memory leak fixes based on valgrind checks. The fixes are specifically: failure to free global dir path variables when not compiled with threading on and failure to free filters from the filter registry that had not be initialized fully.
Russell Belfer fcd324c6 2013-12-06T15:04:31 Add git_vector_free_all There are a lot of places that we call git__free on each item in a vector and then call git_vector_free on the vector itself. This just wraps that up into one convenient helper function.
Russell Belfer 96869a4e 2013-12-03T16:45:39 Improve GIT_EUSER handling This adds giterr_user_cancel to return GIT_EUSER and clear any error message that is sitting around. As a result of using that in places, we need to be more thorough with capturing errors that happen inside a callback when used internally. To help with that, this also adds giterr_capture and giterr_restore so that when we internally use a foreach-type function that clears errors and converts them to GIT_EUSER, it is easier to restore not just the return value, but the actual error message text.
Paul Holden 8f460f2c 2013-12-05T20:41:12 blame.c: Remove unnecessary error-check and goto In private function 'load_blob'.
Ben Straub b20c40a8 2013-11-12T19:02:28 Don't leak memory when duplicating a NULL signature
Ben Straub 9db56cc4 2013-11-12T18:57:16 Fix buffer blame with new lines at end of file
Ben Straub 089297b2 2013-11-12T15:24:59 Duplicate all fields of a blame hunk
Ben Straub 8adea28a 2013-11-05T11:42:42 Blame: change signature to be more binding-friendly
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 364d800b 2013-10-10T14:53:07 Move flag dependencies into docs and code.
Ben Straub c1ca2b67 2013-10-10T14:30:05 Include signatures in blame hunks
Ben Straub b6f60a4d 2013-09-21T22:02:23 Clean up ported code
Ben Straub 77db6ff5 2013-09-21T22:01:53 Simplify blob loading logic
Ben Straub f0c9d8ba 2013-09-21T21:19:33 Clean up old methods, format long lines Added back the line index. We'll need it later.
Ben Straub 0a0f0558 2013-09-20T15:51:22 git_blame is a scoreboard
Ben Straub ef03d040 2013-09-20T15:38:15 Trim fat from git_blame struct
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 d1228f1c 2013-09-19T14:18:51 blame: allow restriction to line range
Ben Straub 3e0cf2a1 2013-09-19T10:27:37 Stop being crazy about freeing memory
Ben Straub ceab4e26 2013-09-16T16:20:38 Port blame from git.git