Commit Graph

9561 Commits

Author SHA1 Message Date
Carlos Martín Nieto
e2bb9ed371 CHANGELOG: add a note about _fromstream() and _fromstream_commit() 2016-03-22 20:00:25 +01:00
Carlos Martín Nieto
35e68606da blob: fix fromchunks iteration counter
By returning when the count goes to zero rather than below it, setting
`howmany` to 7 in fact writes out the string 6 times.

Correct the termination condition to write out the string the amount of
times we specify.
2016-03-22 20:00:24 +01:00
Carlos Martín Nieto
0a5c602889 blob: introduce creating a blob by writing into a stream
The pair of `git_blob_create_frombuffer()` and
`git_blob_create_frombuffer_commit()` is meant to replace
`git_blob_create_fromchunks()` by providing a way for a user to write a
new blob when they want filtering or they do not know the size.

This approach allows the caller to retain control over when to add data
to this buffer and a more natural fit into higher-level language's own
stream abstractions instead of having to handle IO wait in the callback.

The in-memory buffer size of 2MB is chosen somewhat arbitrarily to be a
round multiple of usual page sizes and a value where most blobs seem
likely to be either going to be way below or way over that size. It's
also a round number of pages.

This implementation re-uses the helper we have from `_fromchunks()` so
we end up writing everything to disk, but hopefully more efficiently
than with a default filebuf. A later optimisation can be to avoid
writing the in-memory contents to disk, with some extra complexity.
2016-03-22 19:34:08 +01:00
Carlos Martín Nieto
3fa764edd2 filebuf: allow using a custom buffer size
Allow setting the buffer size on open in order to use this data
structure more generally as a spill buffer, with larger buffer sizes for
specific use-cases.
2016-03-22 19:34:08 +01:00
Edward Thomson
e2e4bae9a0 tree: drop the now-unnecessary entries vector
Remove the now-unnecessary entries vector.  Add `git_array_search`
to binary search through an array to accomplish this.
2016-03-22 06:21:13 -07:00
Carlos Martín Nieto
e50a49ee9b Merge pull request #3559 from yongthecoder/master
Add a sanity check in git_indexer_commit to avoid subtraction overflow.
2016-03-22 01:54:49 -07:00
Carlos Martín Nieto
cec320fe87 Merge pull request #3701 from jfultz/fix-0.24.0-changelog
Fix some errors I found in the changelog for 0.24.0
2016-03-22 00:44:05 -07:00
Edward Thomson
7adca53ed6 Merge pull request #3702 from libgit2/cmn/tree-reuse
Reuse a tree's buffer and allocate constant-sized entries in an array
2016-03-21 21:29:33 -07:00
Carlos Martín Nieto
6f09911c0f config: don't special-case multivars that don't exist yet
This special-casing ignores that we might have a locked file, so the
hashtable does not represent the contents of the file we want to
write. This causes multivar writes to overwrite entries instead of add
to them when under lock.

There is no need for this as the normal code-path will write to the file
just fine, so simply get rid of it.
2016-03-21 22:25:12 +01:00
Carlos Martín Nieto
4ed9e939e2 tree: store the entries in a growable array
Take advantage of the constant size of tree-owned arrays and store them
in an array instead of a pool. This still lets us free them all at once
but lets the system allocator do the work of fitting them in.
2016-03-20 12:01:45 +01:00
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
John Fultz
0b24855ea8 Fix some errors I found in the changelog for 0.24.0 2016-03-18 15:03:08 -05: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