Commit Graph

8792 Commits

Author SHA1 Message Date
Carlos Martín Nieto
f555f7cd70 Merge pull request #3479 from ethomson/cplusplus
api: be explicit about our C linkage
2015-10-21 20:36:38 +02:00
Edward Thomson
0f9b6742ad win32: add c linkage guard around inttypes.h inclusion 2015-10-21 09:24:10 -04:00
Vicent Marti
855f048a7b Merge pull request #3478 from libgit2/vmg/crud
signature: Strip crud
2015-10-21 14:41:13 +02:00
Vicent Marti
bbe1957b8c tests: Fix warnings 2015-10-21 12:09:29 +02:00
Vicent Marti
128e94bbbb index: Remove unneeded consts 2015-10-21 12:04:53 +02:00
Vicent Marti
307c4a2b6d signature: Strip crud just like Git does 2015-10-21 11:58:44 +02:00
Edward Thomson
4280fabb9f Merge pull request #3466 from libgit2/cmn/quick-parse-64
revwalk: make commit list use 64 bits for time
2015-10-15 07:10:48 -07:00
Carlos Martín Nieto
8321596a49 Merge pull request #3444 from ethomson/add_preserves_conflict_mode
Preserve modes from a conflict in `git_index_insert`
2015-10-15 12:22:10 +02:00
Vicent Marti
d5f7aad810 Merge pull request #3468 from libgit2/vmg/odb-lookups
Fix pathological performance in ODB lookups
2015-10-15 11:09:12 +02:00
Vicent Marti
a0a1b19ab0 odb: Prioritize alternate backends
For most real use cases, repositories with alternates use them as main
object storage. Checking the alternate for objects before the main
repository should result in measurable speedups.

Because of this, we're changing the sorting algorithm to prioritize
alternates *in cases where two backends have the same priority*. This
means that the pack backend for the alternate will be checked before the
pack backend for the main repository *but* both of them will be checked
before any loose backends.
2015-10-14 20:53:01 +02:00
Vicent Marti
43820f204e odb: Be smarter when refreshing backends
In the current implementation of ODB backends, each backend is tasked
with refreshing itself after a failed lookup. This is standard Git
behavior: we want to e.g. reload the packfiles on disk in case they have
changed and that's the reason we can't find the object we're looking
for.

This behavior, however, becomes pathological in repositories where
multiple alternates have been loaded. Given that each alternate counts
as a separate backend, a miss in the main repository (which can
potentially be very frequent in cases where object storage comes from
the alternate) will result in refreshing all its packfiles before we
move on to the alternate backend where the object will most likely be
found.

To fix this, the code in `odb.c` has been refactored as to perform the
refresh of all the backends externally, once we've verified that the
object is nowhere to be found.

If the refresh is successful, we then perform the lookup sequentially
through all the backends, skipping the ones that we know for sure
weren't refreshed (because they have no refresh API).

The on-disk pack backend has been adjusted accordingly: it no longer
performs refreshes internally.
2015-10-14 19:24:07 +02:00
Edward Thomson
ac7e50dd37 Merge pull request #3453 from libgit2/cmn/warn-python
CMake: be more explicit with python errors
2015-10-14 08:30:51 -07:00
Carlos Martín Nieto
5ffdea6f65 revwalk: make commit list use 64 bits for time
We moved the "main" parsing to use 64 bits for the timestamp, but the
quick parsing for the revwalk did not. This means that for large
timestamps we fail to parse the time and thus the walk.

Move this parser to use 64 bits as well.
2015-10-14 16:54:13 +02:00
Carlos Martín Nieto
d8dc2b8f54 Merge pull request #3455 from Eun/master
Examples: network/fetch.c transfer_progress_cb - should return a value
2015-10-07 15:43:36 +02:00
Eun
8b8f1f9188 fix return 2015-10-07 14:01:05 +02:00
Carlos Martín Nieto
e3f94c71c3 CMake: be more explicit with python errors
There's been a few reports of users not understanding what the python
error means, so spell out the options they have.
2015-10-06 13:35:45 +02:00
Edward Thomson
ac69a82358 Merge pull request #3451 from ethomson/xdiff
xdiff fixes
2015-10-06 00:21:28 +02:00
Edward Thomson
ae195a71ae blame: guard xdiff calls for large files 2015-10-05 22:59:53 +02:00
Edward Thomson
6c014bcc54 diff: don't feed large files to xdiff 2015-10-05 22:59:50 +02:00
Edward Thomson
e43520660c merge_file: treat large files as binary
xdiff craps the bed on large files.  Treat very large files as binary,
so that it doesn't even have to try.

Refactor our merge binary handling to better match git.git, which
looks for a NUL in the first 8000 bytes.
2015-10-05 22:59:46 +02:00
Edward Thomson
46c0e6e3c1 xdiff: convert size variables to size_t 2015-10-05 22:59:41 +02:00
Edward Thomson
4bc9b74c14 GITERR_CHECK_ALLOC_ADDn: multi-arg adders 2015-10-05 22:59:36 +02:00
Carlos Martín Nieto
a99f33e9b0 Merge pull request #3447 from arthurschreiber/arthur/fix-odb-refdb-free
refdb and odb backends must provide `free` function
2015-10-01 07:56:19 +02:00
Arthur Schreiber
d3b29fb94b refdb and odb backends must provide free function
As refdb and odb backends can be allocated by client code, libgit2
can’t know whether an alternative memory allocator was used, and thus
should not try to call `git__free` on those objects.

Instead, odb and refdb backend implementations must always provide
their own `free` functions to ensure memory gets freed correctly.
2015-10-01 00:50:37 +02:00
Carlos Martín Nieto
ba1a5553e4 Merge pull request #3446 from ethomson/portability
portability: use `CHECK_FUNCTION_EXISTS` for checking whether functions exist...
2015-09-30 17:44:10 +02:00
Edward Thomson
e8ccdd6bdf Merge pull request #3445 from libgit2/cmn/ssl-null
openssl: don't try to teardown an unconnected SSL context
2015-09-30 06:29:01 -07:00
Edward Thomson
21515f228b index: also try conflict mode when inserting
When we do not trust the on-disk mode, we use the mode of an existing
index entry.  This allows us to preserve executable bits on platforms
that do not honor them on the filesystem.

If there is no stage 0 index entry, also look at conflicts to attempt
to answer this question:  prefer the data from the 'ours' side, then
the 'theirs' side before falling back to the common ancestor.
2015-09-30 09:06:09 -04:00
Edward Thomson
e683d15247 qsort_r/qsort_s: detect their support 2015-09-30 05:49:04 -04:00
Edward Thomson
8649dfd8df p_futimes: support using futimens when available 2015-09-30 05:37:20 -04:00
Carlos Martín Nieto
146a96de82 openssl: don't try to teardown an unconnected SSL context
SSL_shutdown() does not like it when we pass an unitialized ssl context
to it. This means that when we fail to connect to a host, we hide the
error message saying so with OpenSSL's indecipherable error message.
2015-09-30 09:41:25 +02:00
Carlos Martín Nieto
72b7c57093 Merge pull request #3411 from spraints/custom-push-headers
Include custom HTTP headers
2015-09-30 09:17:18 +02:00
Carlos Martín Nieto
c628ebca63 Merge pull request #3443 from libgit2/longpath-printf
win32::longpath: don't print path
2015-09-29 21:46:00 +02:00
Edward Thomson
10df661b8c index: test that add_bypath preserves mode 2015-09-29 14:16:51 -04:00
Edward Thomson
ea467e7487 win32::longpath: don't print path 2015-09-28 16:46:09 -04:00
Edward Thomson
fc3ef147ec Merge pull request #3441 from libgit2/cmn/badssl
net: add tests against badssl.com
2015-09-28 06:41:00 -07:00
Carlos Martín Nieto
5c5df666b0 Plug some leaks 2015-09-27 23:32:20 +02:00
Carlos Martín Nieto
53a2870514 net: add tests against badssl.com
These provide bad X.509 certificates, which we should refuse to connect
to by default.
2015-09-27 22:56:25 +02:00
Edward Thomson
a8d0b4de92 Merge pull request #3439 from bisho/master
Fix binary diffs
2015-09-25 17:55:31 -04:00
Guille -bisho-
e4b2b919bb Fix binary diffs
git expects an empty line after the binary data:

literal X
...binary data...
<empty_line>

The last literal block of the generated patches were not containing the required empty line. Example:

	diff --git a/binary_file b/binary_file
	index 3f1b3f9098131cfecea4a50ff8afab349ea66d22..86e5c1008b5ce635d3e3fffa4434c5eccd8f00b6 100644
	GIT binary patch
	literal 8
	Pc${NM&PdElPvrst3ey5{

	literal 6
	Nc${NM%g@i}0ssZ|0lokL
	diff --git a/binary_file2 b/binary_file2
	index 31be99be19470da4af5b28b21e27896a2f2f9ee2..86e5c1008b5ce635d3e3fffa4434c5eccd8f00b6 100644
	GIT binary patch
	literal 8
	Pc${NM&PdElPvrst3ey5{

	literal 13
	Sc${NMEKbZyOexL+Qd|HZV+4u-

git apply of that diff results in:

	error: corrupt binary patch at line 9: diff --git a/binary_file2 b/binary_file2
	fatal: patch with only garbage at line 10

The proper formating is:

	diff --git a/binary_file b/binary_file
	index 3f1b3f9098131cfecea4a50ff8afab349ea66d22..86e5c1008b5ce635d3e3fffa4434c5eccd8f00b6 100644
	GIT binary patch
	literal 8
	Pc${NM&PdElPvrst3ey5{

	literal 6
	Nc${NM%g@i}0ssZ|0lokL
	diff --git a/binary_file2 b/binary_file2
	index 31be99be19470da4af5b28b21e27896a2f2f9ee2..86e5c1008b5ce635d3e3fffa4434c5eccd8f00b6 100644
	GIT binary patch
	literal 8
	Pc${NM&PdElPvrst3ey5{

	literal 13
	Sc${NMEKbZyOexL+Qd|HZV+4u-
2015-09-25 10:37:41 -07:00
Matt Burke
d7375662e7 Copy custom_headers insteach of referencing the caller's copy 2015-09-25 10:16:30 -04:00
Matt Burke
d16c1b978f These can be static 2015-09-24 10:32:29 -04:00
Matt Burke
e60db3c79a Revise custom header error messages
If the header doesn't look like a header (e.g. if it doesn't have a ":"
or if it has newlines), report "custom HTTP header '%s' is malformed".

If the header has the same name as a header already set by libgit2 (e.g.
"Host"), report "HTTP header '%s' is already set by libgit2".
2015-09-24 09:24:10 -04:00
Matt Burke
63cc57232c Don't null-check 2015-09-24 09:13:05 -04:00
Matt Burke
098f1e6e25 Use an array of forbidden custom headers 2015-09-24 09:09:48 -04:00
Carlos Martín Nieto
588e28ebfd Merge pull request #3437 from libgit2/cmn/plug-sm
submodule: plug a few leaks
2015-09-24 13:20:48 +02:00
Carlos Martín Nieto
ab8f2c669a submodule: plug a few leaks 2015-09-24 11:37:31 +02:00
Carlos Martín Nieto
27187344bb Merge pull request #3435 from ethomson/nametoolong
win32: give better error message on long paths
2015-09-23 15:16:01 +02:00
Edward Thomson
9768ebb1f3 win32: test checkout msg on long path err 2015-09-23 08:27:24 -04:00
Edward Thomson
92a47824d8 win32: propogate filename too long errors 2015-09-22 23:10:56 -04:00
Carlos Martín Nieto
aebddbe736 Merge pull request #3434 from ethomson/reservednames
Win32 Reserved names: don't reserve names outside the working directory
2015-09-21 06:01:03 +02:00