Commit Graph

9176 Commits

Author SHA1 Message Date
Vicent Marti
66eb7660a8 pool: Handle 32 bit systems 2015-10-28 10:29:00 +01:00
Vicent Marti
410efda80b pool: Take into account malloc overhead & pool page size 2015-10-28 10:28:43 +01:00
Vicent Marti
4f971852d5 repository: plug memory leak
cc @carlosmn
2015-10-28 10:15:24 +01:00
Vicent Marti
1e5e02b4f4 pool: Simplify implementation 2015-10-28 10:13:13 +01:00
Vicent Marti
efc659b071 Merge pull request #3489 from libgit2/vmg/reuc-insert
Better REUC generation when merging
2015-10-28 09:55:20 +01:00
Vicent Marti
7a02e93e02 merge: Plug memory leak 2015-10-27 22:44:26 +01:00
Vicent Marti
a1f5d691a2 merge: Implement GIT_MERGE_TREE_SKIP_REUC 2015-10-27 22:44:26 +01:00
Vicent Marti
d307a0134b reuc: Be smarter when inserting new REUC entries
Inserting new REUC entries can quickly become pathological given that
each insert unsorts the REUC vector, and both subsequent lookups *and*
insertions will require sorting it again before being successful.

To avoid this, we're switching to `git_vector_insert_sorted`: this keeps
the REUC vector constantly sorted and lets us use the `on_dup` callback
to skip an extra binary search on each insertion.
2015-10-27 22:44:13 +01:00
Carlos Martín Nieto
2382d1bc62 Merge pull request #3485 from srajko/giterr_clear-typo-fix
Fix docs typo geterr_clear -> giterr_clear
2015-10-26 21:13:54 +01:00
Stjepan Rajko
2b96b6ef0c Fix docs typo geterr_clear -> giterr_clear 2015-10-26 10:21:09 -07:00
Edward Thomson
821131fdae Merge pull request #3477 from linquize/inttypes.h
inttypes.h is built-in header file since MSVC 2013
2015-10-23 10:13:14 -05:00
Carlos Martín Nieto
979a5c120c Merge pull request #3483 from ethomson/cmake_xcode
cmake: split sources into original paths for Xcode and MSVC
2015-10-23 15:16:21 +02:00
Carlos Martín Nieto
e324005e8b Merge pull request #3481 from ethomson/xdiff_include
xdiff: reference util.h in parent directory
2015-10-23 15:13:38 +02:00
Vicent Marti
7c0c21c3f3 Merge pull request #3482 from ethomson/merge_fail_on_conflict
merge: add GIT_MERGE_TREE_FAIL_ON_CONFLICT
2015-10-23 13:37:02 +02:00
Edward Thomson
7208ff4d7d cmake: split sources into original paths for Xcode and MSVC
The MSVC_SPLIT_SOURCES function is helpful for other IDEs, like Xcode,
and will split the source files up into their target directories,
instead of merely placing them all in a "Sources" directory.

Rename MSVC_SPLIT_SOURCES to IDE_SPLIT_SOURCES and enable it for Xcode.
2015-10-22 20:17:19 -05:00
Edward Thomson
8683d31f08 merge: add GIT_MERGE_TREE_FAIL_ON_CONFLICT
Provide a new merge option, GIT_MERGE_TREE_FAIL_ON_CONFLICT, which
will stop on the first conflict and fail the merge operation with
GIT_EMERGECONFLICT.
2015-10-22 14:55:17 -04:00
Carlos Martín Nieto
dc2cf3eb1a Merge pull request #3480 from ethomson/nsecs
Nanoseconds in the index: ignore for diffing
2015-10-22 18:35:43 +02:00
Edward Thomson
c7b336b084 xdiff: reference util.h in parent directory
Although CMake will correctly configure include directories for us,
some people may use their own build system, and we should reference
`util.h` based on where it actually lives.
2015-10-22 10:29:51 -04:00
Edward Thomson
7499eae98a diff: ignore nsecs when diffing
Although our index contains the literal time present in the index,
we do not read nanoseconds from disk, and thus we should not use
them in any comparisons, lest we always think our working directory
is dirty.

Guard this behind a `GIT_USE_NSECS` for future improvement.
2015-10-22 09:35:47 -04:00
Edward Thomson
99a09f7f18 index: test that we round-trip nsecs
Test that nanoseconds are round-tripped correctly when we read
an index file that contains them.  We should, however, ignore them
because we don't understand them, and any new entries in the index
should contain a `0` nsecs field, while existing preserving entries.
2015-10-22 09:29:40 -04:00
Linquize
240a85cf10 inttypes.h is built-in header file since MSVC 2013
The reason is that the types defined in libgit2's inttypes.h collide with system inttypes.h
3rd party library header files may directly reference MSVC's built-in inttypes.h

Fixes #3476
2015-10-22 07:56:34 +08:00
Edward Thomson
44b1e3e390 Merge pull request #3475 from libgit2/cmn/programdata-config
config: add a ProgramData level
2015-10-21 13:43:22 -07:00
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
Carlos Martín Nieto
8c7c5fa585 config: add a ProgramData level
This is where portable git stores the global configuration which we can
use to adhere to it even though git isn't quite installed on the system.
2015-10-21 15:11:18 +02: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
Axel Rasmussen
28659e50d5 diff: refactor complex timestamp check into its own function 2015-10-01 18:36:10 -07:00
Axel Rasmussen
973a09a4ca index: don't populate nsec values if GIT_USE_NSEC is off 2015-10-01 18:35:21 -07:00
Axel Rasmussen
c7b17fb5cd Merge branch 'master' into nsec_fix_next 2015-10-01 18:01:32 -07: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