Commit Graph

3381 Commits

Author SHA1 Message Date
Russell Belfer
e597b1890e Move diff max_size to public API
This commit adds a max_size value in the public `git_diff_options`
structure so that the user can automatically flag blobs over a
certain size as binary regardless of other properties.

Also, and perhaps more importantly, this moves binary detection
to be as early as possible in the diff traversal inner loop and
makes sure that we stop loading objects as soon as we decide that
they are binary.
2012-09-10 11:49:12 -07:00
Russell Belfer
b36effa22e Replace git_diff_iterator_num_files with progress
The `git_diff_iterator_num_files` API was problematic, since we
don't actually know the exact number of files to be iterated over
until we load those files into memory.  This replaces it with a
new `git_diff_iterator_progress` API that goes from 0 to 1, and
moves and renamed the old API for the internal places that can
tolerate a max value instead of an exact value.
2012-09-10 09:59:14 -07:00
Sascha Cunz
857323d4db git_mergebase: Constness-Fix for consistency 2012-09-09 15:53:57 +02:00
Russell Belfer
17b06f4d47 Add missing accessor for fetchRecurseSubmodules
When `git_submodule` became an opaque structure, I forgot to add
accessor functions for the fetchRecurseSubmodules config setting.
This fixes that.
2012-09-07 15:49:08 -07:00
Russell Belfer
3a3deea80b Clean up blob diff path
Previously when diffing blobs, the diff code just ran with a NULL
repository object. Of course, that's not necessary and the test
for a NULL repo was confusing. This makes the blob diff run with
the repo that contains the blobs and clarifies the test that it
is possible to be diffing data where the path is unknown.
2012-09-06 15:45:50 -07:00
Russell Belfer
60b9d3fcef Implement filters for status/diff blobs
This adds support to diff and status for running filters (a la crlf)
on blobs in the workdir before computing SHAs and before generating
text diffs.  This ended up being a bit more code change than I had
thought since I had to reorganize some of the diff logic to minimize
peak memory use when filtering blobs in a diff.

This also adds a cap on the maximum size of data that will be loaded
to diff.  I set it at 512Mb which should match core git.  Right now
it is a #define in src/diff.h but it could be moved into the public
API if desired.
2012-09-06 15:34:02 -07:00
Russell Belfer
8f9b6a132b Better header comments 2012-09-06 15:34:02 -07:00
Russell Belfer
f8e2cc9a0a Alternate test for autocrlf with status
I couldn't get the last failing test to actually fail.  This
is a different test suggested by @nulltoken which should fail.
2012-09-06 15:24:03 -07:00
pontusm
52462e1cce Test case to reproduce issue #690.
Staged file status does not handle CRLF correctly. Ensures that the test repo has core.autocrlf=true for the test to fail.
2012-09-06 15:24:03 -07:00
nulltoken
cf4c43abaa object: make git_object_peel() test more readable 2012-09-06 18:40:09 +02:00
nulltoken
746642a6b3 checkout: fix documentation code alignment 2012-09-06 18:40:08 +02:00
nulltoken
35d2e449bd checkout: cleanup misplaced declaration 2012-09-06 18:40:07 +02:00
nulltoken
ced8d1420a errors: deploy GIT_EBAREREPO usage 2012-09-06 18:40:06 +02:00
nulltoken
bb2d305c20 errors: introduce GIT_EBAREREPO 2012-09-06 18:40:06 +02:00
nulltoken
316659489a refs: introduce git_reference_peel()
Fix #530
2012-09-06 18:40:05 +02:00
Michael Schubert
0e9f2fcef6 odb: mark unused variable 2012-09-06 11:35:09 +02:00
Vicent Martí
7a3fc9fb17 Merge pull request #900 from pwkelley/development
Expose a malloc function to 3rd party ODB backends
2012-09-06 01:17:23 -07:00
Vicent Martí
4e2b8b4cdc Merge pull request #912 from schu/netops-ssl-error
netops: be more careful with SSL errors
2012-09-06 01:15:14 -07:00
Vicent Marti
01ae1909c5 diff: Cleanup documentation and printf compat 2012-09-06 10:13:38 +02:00
Vicent Marti
2e4a9ea9cf Merge remote-tracking branch 'arrbee/diff-iterator' into development 2012-09-06 10:08:14 +02:00
Russell Belfer
27730eefb9 Merge pull request #917 from arrbee/test-issue-835
Test for gitmodules only submodule def
2012-09-05 16:31:44 -07:00
Russell Belfer
fed886d990 Test for gitmodules only submodule def
This should confirm that issue #835 is fixed where a submodule that
is only declared in the .gitmodules file was not accessible via the
submodule APIs.
2012-09-05 15:54:32 -07:00
Russell Belfer
510f1bac6b Fix comments and a minor bug
This adds better header comments and also fixes a bug in one of
simple APIs that tells the number of lines in the current hunk.
2012-09-05 15:17:24 -07:00
Russell Belfer
f335ecd6e1 Diff iterators
This refactors the diff output code so that an iterator object
can be used to traverse and generate the diffs, instead of just
the `foreach()` style with callbacks.  The code has been rearranged
so that the two styles can still share most functions.

This also replaces `GIT_REVWALKOVER` with `GIT_ITEROVER` and uses
that as a common error code for marking the end of iteration when
using a iterator style of object.
2012-09-05 15:17:24 -07:00
Vicent Martí
4d3834038b Merge pull request #856 from libgit2/utf8-win
Windows: Perform UTF-8 path conversion on the Stack
2012-09-04 14:19:24 -07:00
Vicent Marti
c9d223f0de branch: Add missing include 2012-09-04 22:57:31 +02:00
Carlos Martín Nieto
f9988d4e4c odb: pass the user's data pointer correctly in foreach 2012-09-04 21:42:00 +02:00
Carlos Martín Nieto
064ee42d99 travis: use a valgrind suppressions file
We don't care about the supposed zlib errors, and the leak from
giterr_set isn't interesting, as it gets freed each time an error is
set.

Give valgrind a suppressions file so it doesn't tell us about them.
2012-09-04 16:00:49 +02:00
Vicent Marti
925be045d5 clar: Clear errors on shutdown 2012-09-04 15:40:28 +02:00
authmillenon
0e2dd29ba5 Fix logical error in git_index_set_caps 2012-09-04 12:12:48 +02:00
Vicent Martí
af6bcd8b93 Merge pull request #913 from nulltoken/fix/warnings
Fix MSVC compilation warnings
2012-09-04 01:06:34 -07:00
nulltoken
b97c169ec0 Fix MSVC compilation warnings 2012-09-04 10:01:18 +02:00
Michael Schubert
65ac67fbbd netops: be more careful with SSL errors
SSL_get_error() allows to receive a result code for various SSL
operations. Depending on the return value (see man (3) SSL_get_error)
there might be additional information in the OpenSSL error queue. Return
the queued message if available, otherwise set an error message
corresponding to the return code.
2012-09-04 00:22:12 +02:00
Michael Schubert
4deda91bda netops: continue writing on SSL_ERROR_WANT_WRITE 2012-09-04 00:14:16 +02:00
Ben Straub
22e1b4b8a8 Ignore tags file 2012-08-30 07:55:36 -07:00
Russell Belfer
04d4fe5ef0 Merge pull request #908 from nulltoken/bug/repo_reinit_init
repository: add failing repo initialization test
2012-08-29 11:01:46 -07:00
nulltoken
89cd5708d9 repository: make initialization cope with missing core.worktree 2012-08-29 19:56:55 +02:00
Vicent Marti
0f4c61754b Add bounds checking to UTF-8 conversion 2012-08-28 23:26:00 -07:00
Vicent Marti
6813169ac9 windows: Keep UTF-8 on the stack yo 2012-08-28 23:09:43 -07:00
Vicent Martí
3b73a03497 UTF-8 changes yo 2012-08-28 23:09:42 -07:00
Vicent Martí
319ad0ba20 Merge pull request #905 from carlosmn/signature-now
signature: make the OS give us the offset for git_signature_now
2012-08-28 13:55:55 -07:00
Michael Schubert
0844ed069e Fix parentheses warning 2012-08-28 20:22:44 +02:00
Carlos Martín Nieto
d03d309b10 signature: make the OS give us the offset for git_signature_now
There is a better and less fragile way to calculate time offsets. Let
the OS take care of dealing with DST and simply take the the offset
between the local time and UTC that it gives us.
2012-08-28 18:02:12 +02:00
Carlos Martín Nieto
0d5dce268d ssl: make cert check ignore work for invalid certs, not just CNs
Passing SSL_VERIFY_PEER makes OpenSSL shut down the connection if the
certificate is invalid, without giving us a chance to ignore that
error. Pass SSL_VERIFY_NONE and call SSL_get_verify_result if the user
wanted us to check.

When no CNs match, we used to jump to on_error which gave a bogus
error as that's for OpenSSL errors. Jump to cert_fail so we tell the
user that the error came from checking the certificate.
2012-08-28 15:39:06 +02:00
Vicent Marti
62eafd0620 Merge branch 'branch-delete-ref' into development
Conflicts:
	include/git2/refs.h
2012-08-27 14:54:52 -07:00
Vicent Martí
bd2887a5e5 Merge pull request #904 from arrbee/better-object-peel
Make git_object_peel a bit smarter
2012-08-27 14:52:26 -07:00
Vicent Martí
b9d283d14a Merge pull request #897 from nulltoken/topic/git_reference_check_format
refs: expose git_reference_normalize_name()
2012-08-27 13:39:17 -07:00
Vicent Martí
05752700c7 Merge pull request #899 from schu/revwalk-push
revwalk: refuse push of non-commit objects
2012-08-27 13:35:58 -07:00
Russell Belfer
d8057a5b0e Make git_object_peel a bit smarter
This expands the types of peeling that `git_object_peel` knows
how to do to include TAG -> BLOB peeling, and makes the errors
slightly more consistent depending on the situation.  It also
adds a new special behavior where peeling to ANY will peel until
the object type changes (e.g. chases TAGs to a non-TAG).

Using this expanded peeling, this replaces peeling code that was
embedded in `git_tag_peel` and `git_reset`.
2012-08-27 11:53:59 -07:00
Russell Belfer
0b9174c621 Merge pull request #903 from nulltoken/topic/peeling-duplication
branch: reduce code duplication
2012-08-27 11:45:48 -07:00