Commit Graph

9246 Commits

Author SHA1 Message Date
Carlos Martín Nieto
60a194aa86 tree: re-use the id and filename in the odb object
Instead of copying over the data into the individual entries, point to
the originals, which are already in a format we can use.
2016-03-20 11:00:12 +01:00
Edward Thomson
ec5a43b60a Merge pull request #3699 from libgit2/cmn/win32-free-tls
win32: free thread-local data on thread exit
2016-03-18 06:37:41 -07:00
Carlos Martin Nieto
a177756b34 win32: free thread-local data on thread exit 2016-03-18 13:05:10 -07:00
Edward Thomson
3a43677ec6 Merge pull request #3660 from mstrap/mingw
MinGW builds should optionally create DLLs without "lib" prefix
2016-03-18 06:37:04 -07:00
Carlos Martín Nieto
e18df18bea Merge pull request #3564 from ethomson/merge_drivers
Custom merge drivers and proper gitattributes `merge` handling
2016-03-17 18:01:37 +01:00
Carlos Martín Nieto
e02acbb3c6 Merge pull request #3695 from ethomson/contributing
CONTRIBUTING: document the optional tests
2016-03-17 17:25:49 +01:00
Edward Thomson
1308059d95 CONTRIBUTING: document the optional tests 2016-03-17 12:01:37 -04:00
Edward Thomson
d953c4505e merge drivers: handle configured but not found driver 2016-03-17 11:06:00 -04:00
Edward Thomson
6d8b2cdbee merge driver: remove check callback
Since the `apply` callback can defer, the `check` callback is not
necessary.  Removing the `check` callback further makes the `payload`
unnecessary along with the `cleanup` callback.
2016-03-17 11:06:00 -04:00
Edward Thomson
3f7d3df1ec merge driver: improve inline documentation 2016-03-17 11:06:00 -04:00
Edward Thomson
967e073dca merge driver: correct global initialization 2016-03-17 11:06:00 -04:00
Edward Thomson
7a3ab14fee merge driver: get a pointer to favor 2016-03-17 11:02:27 -04:00
Edward Thomson
4662583692 merge driver: correct indentation 2016-03-17 11:02:27 -04:00
Edward Thomson
58d33126d4 merge driver: tests for set and unset merge attribute
Ensure that setting the merge attribute forces the built-in default
`text` driver and does *not* honor the `merge.default` configuration
option.  Further ensure that unsetting the merge attribute forces
a conflict (the `binary` driver).
2016-03-17 11:02:27 -04:00
Edward Thomson
d3f0875a60 merge driver: tests for custom default merge drivers 2016-03-17 11:02:27 -04:00
Edward Thomson
30a94ab756 merge driver: allow custom default driver
Allow merge users to configure a custom default merge driver via
`git_merge_options`.  Similarly, honor the `merge.default` configuration
option.
2016-03-17 11:02:27 -04:00
Edward Thomson
7d307c1edc merge driver: test GIT_EMERGECONFLICT
When a `check` or `apply` callback function returns `GIT_EMERGECONFLICT`
stop and product a conflict.
2016-03-17 11:02:27 -04:00
Edward Thomson
59f2931465 merge driver: test GIT_PASSTHROUGH
When a `check` or `apply` callback function returns `GIT_PASSTHROUGH`,
move on to the default merge driver.
2016-03-17 11:02:27 -04:00
Edward Thomson
3f04219fcd merge driver: introduce custom merge drivers
Consumers can now register custom merged drivers with
`git_merge_driver_register`.  This allows consumers to support the
merge drivers, as configured in `.gitattributes`.  Consumers will be
asked to perform the file-level merge when a custom driver is
configured.
2016-03-17 11:02:26 -04:00
Stan Hu
7a74590d8f Fix rebase bug and include test for merge=union 2016-03-17 11:02:26 -04:00
Stan Hu
f8787098fb Support union merges via .gitattributes file 2016-03-17 11:02:26 -04:00
Edward Thomson
ba3493228c Merge pull request #3673 from libgit2/cmn/commit-with-signature
commit: add function to attach a signature to a commit
2016-03-17 06:57:56 -07:00
Edward Thomson
a151eb544b Merge pull request #3685 from pks-t/pks/memleaks
Test memleaks
2016-03-17 06:55:24 -07:00
Edward Thomson
31dc0599c5 Merge pull request #3687 from mstrap/CMAKE_C_FLAGS_DEBUG
CMake: do not overwrite but only append to CMAKE_C_FLAGS_DEBUG
2016-03-17 06:54:03 -07:00
Edward Thomson
62e237e031 Merge pull request #3693 from libgit2/cmn/extract-oneline-sig
commit: fix extraction of single-line signatures
2016-03-17 06:43:54 -07:00
Carlos Martín Nieto
bf804d407e commit: fix extraction of single-line signatures
The function to extract signatures suffers from a similar bug to the
header field finding one by having an unecessary line feed check as a
break condition of its loop.

Fix that and add a test for this single-line signature situation.
2016-03-17 10:48:06 +01:00
Edward Thomson
de143efa88 Merge pull request #3690 from libgit2/cmn/pool-limit
win32: choose the page size as our value for the page size
2016-03-16 14:12:14 -07:00
Carlos Martín Nieto
87c181970d Split the page size from the mmap alignment
While often similar, these are not the same on Windows. We want to use the page
size on Windows for the pools, but for mmap we need to use the allocation
granularity as the alignment.

On the other platforms these values remain the same.
2016-03-16 21:36:25 +01:00
Marc Strapetz
059f33bf75 Option "LIBGIT2_PREFIX" to set the CMAKE's TARGET_PROPERTIES PREFIX
This is especially useful in combination with MinGW to yield the
Windows-compliant DLL name "git2.dll" instead of "libgit2.dll"
2016-03-15 18:32:37 +01:00
Marc Strapetz
08f030ced7 CMake: do not overwrite but only append to CMAKE_C_FLAGS_DEBUG
This is useful to force "smart" IDEs (like CLIon) to use debug
flag -g even it may have decided that "-D_DEBUG" (which is
already present) is sufficient.
2016-03-15 18:23:54 +01:00
Carlos Martín Nieto
02d61a3b66 commit: add function to attach a signature to a commit
In combination with the function which creates a commit into a buffer,
this allows us to more easily create signed commits.
2016-03-15 12:55:03 +01:00
Carlos Martín Nieto
77394a27af Merge pull request #3677 from pks-t/pks/coverity-fixes-round7
Coverity fixes round 7
2016-03-14 19:15:20 +01:00
Carlos Martín Nieto
4848dd326a Merge pull request #3647 from pks-t/pks/coverity-fixes-round6
Coverity fixes round 6
2016-03-14 17:45:15 +01:00
Edward Thomson
fa31ee6835 Merge pull request #3671 from libgit2/cmn/remove-mingw32
Remove CI support for mingw32
2016-03-14 15:00:59 +00:00
Carlos Martín Nieto
ff5a39678b Merge pull request #3683 from dbussink/dbussink/better-openssl-ciphers
Setup better defaults for OpenSSL ciphers
2016-03-14 15:29:30 +01:00
Dirkjan Bussink
c577efbbb5 Use general cl_git_fail because the error is generic 2016-03-14 12:41:41 +00:00
Dirkjan Bussink
8f4cbc76bd Start error string with lower case character 2016-03-14 12:41:12 +00:00
Dirkjan Bussink
fa72d6daf8 Setup better defaults for OpenSSL ciphers
This ensures that when using OpenSSL a safe default set of ciphers
is selected. This is done so that the client communicates securely
and we don't accidentally enable unsafe ciphers like RC4, or even
worse some old export ciphers.

Implements the first part of https://github.com/libgit2/libgit2/issues/3682
2016-03-14 12:07:13 +00:00
Carlos Martín Nieto
b1093e62d5 Remove CI support for mingw32
The tests have never run successfully and we do have successful builds
of mingw-w64, so remove these CI builds which do not add value.
2016-03-14 11:05:58 +01:00
Carlos Martín Nieto
1ddada422c Merge pull request #3636 from nerdishbynature/fix-non-modular-header-in-module
Don't include inttypes if compiling for Mac/iOS
2016-03-11 16:31:32 +01:00
Patrick Steinhardt
13c371dc10 config_cache: check return value of git_config__lookup_entry
Callers of `git_config__cvar` already handle the case where the
function returns an error due to a failed configuration variable
lookup, but we are actually swallowing errors when calling
`git_config__lookup_entry` inside of the function.

Fix this by returning early when `git_config__lookup_entry`
returns an error. As we call `git_config__lookup_entry` with
`no_errors == false` which leads us to call `get_entry` with
`GET_NO_MISSING` we will not return early when the lookup fails
due to a missing entry. Like this we are still able to set the
default value of the cvar and exit successfully.
2016-03-11 14:20:15 +01:00
Patrick Steinhardt
6ff8a7c4be filebuf: handle write error in lock_file
When writing to a file with locking not check if writing the
locked file actually succeeds. Fix the issue by returning error
code and message when writing fails.
2016-03-11 14:20:15 +01:00
Patrick Steinhardt
836447e586 config_file: handle error when trying to lock strmap
Accessing the current values map is handled through the
`refcounder_strmap_take` function, which first acquires a mutex
before accessing its values. While this assures everybody is
trying to access the values with the mutex only we do not check
if the locking actually succeeds.

Fix the issue by checking if acquiring the lock succeeds and
returning `NULL` if we encounter an error. Adjust callers.
2016-03-11 14:20:15 +01:00
Patrick Steinhardt
e850e98ddb 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`.
2016-03-11 14:20:15 +01:00
Patrick Steinhardt
8a4a343a2b blame_git: handle error returned by git_commit_parent 2016-03-11 14:20:15 +01:00
Patrick Steinhardt
b27ccad274 refdb_fs: fail if refcache returns NULL pointer
We usually check entries returned by `git_sortedcache_entry` for
NULL pointers. As we have a write lock in `packed_write`, though,
it really should not happen that the function returns NULL.

Assert that ref is not NULL to silence a Coverity warning.
2016-03-11 14:20:15 +01:00
Patrick Steinhardt
2615d0d694 coverity: report errors when uploading tarball
Curl by default does not report errors by setting the error code.
As the upload can fail through several conditions (e.g. the rate
limit, leading to unauthorized access) we should indicate this
information in Travis CI.

To improve upon the behavior, use `--write-out=%{http_code}` to
write out the HTTP code in addition to the received body and
return an error if the code does not equal 201.
2016-03-11 13:31:12 +01:00
Patrick Steinhardt
1a8c11f443 diff_tform: fix potential NULL pointer access
When the user passes in a diff which has no repository associated
we may call `git_config__get_int_force` with a NULL-pointer
configuration. Even though `git_config__get_int_force` is
designed to swallow errors, it is not intended to be called with
a NULL pointer configuration.

Fix the issue by only calling `git_config__get_int_force` only
when configuration could be retrieved from the repository.
2016-03-11 13:30:33 +01:00
Patrick Steinhardt
486302d6af submodule: avoid passing NULL pointers to strncmp
In C89 it is undefined behavior to pass `NULL` pointers to
`strncmp` and later on in C99 it has been explicitly stated that
functions with an argument declared as `size_t nmemb` specifying
the array length shall always have valid parameters, no matter if
`nmemb` is 0 or not (see ISO 9899 §7.21.1.2).

The function `str_equal_no_trailing_slash` always passes its
parameters to `strncmp` if their lengths match. This means if one
parameter is `NULL` and the other one either `NULL` or a string
with length 0 we will pass the pointers to `strncmp` and cause
undefined behavior.

Fix this by explicitly handling the case when both lengths are 0.
2016-03-11 12:14:02 +01:00
Patrick Steinhardt
3fe5768b06 pack-objects: fix memory leak on overflow 2016-03-11 12:14:02 +01:00