Commit Graph

8400 Commits

Author SHA1 Message Date
Carlos Martín Nieto
58ca8c7e1f SecureTransport: use the curl stream if available
If the libcurl stream is available, use that as the underlying stream
instead of the socket stream. This allows us to set a proxy for HTTPS
connections.
2015-06-24 17:27:16 +02:00
Carlos Martín Nieto
8443f492dd curl: remove the encrypted param to the constructor
We do not want libcurl to perform the TLS negotiation for us, so we
don't need to pass this option.
2015-06-24 17:26:36 +02:00
Carlos Martín Nieto
f97d5d090c http: ask for the curl stream for non-encrypted connections
The TLS streams talk over the curl stream themselves, so we don't need
to ask for it explicitly. Do so in the case of the non-encrypted one so
we can still make use proxies in that case.
2015-06-24 17:26:36 +02:00
Carlos Martín Nieto
e247649dfa openssl: use the curl stream if available
When linking against libcurl, use it as the underlying transport instead
of straight sockets. We can't quite just give over the file descriptor,
as curl puts it into non-blocking mode, so we build a custom BIO so
OpenSSL sends the data through our stream, be it the socket or curl
streams.
2015-06-24 17:26:36 +02:00
Carlos Martín Nieto
cdee630f6f curl: extract certificate information
The information is exposed by curl for some crypto libraries in the form
of name:content strings. We can't do much more than return this
information.
2015-06-24 17:26:36 +02:00
Carlos Martín Nieto
8762d721f4 http: set the proxy if the stream supports it
Of the built-in ones, only cURL support it, but there's no reason a
user-provided stream wouldn't support it.
2015-06-24 17:26:36 +02:00
Carlos Martín Nieto
1376e784c6 stream: add support for setting a proxy
If the stream claims to support this feature, we can let the transport
set the proxy.

We also set HTTPPROXYTUNNEL option so curl can create a tunnel through
the proxy which lets us create our own TLS session (if needed).
2015-06-24 17:26:36 +02:00
Carlos Martín Nieto
ede517bc53 curl: add CHANGELOG and THREADING entries 2015-06-24 17:26:36 +02:00
Carlos Martín Nieto
8dea1c21f5 Implement a curl stream
cURL has a mode in which it acts a lot like our streams, providing send
and recv functions and taking care of the TLS and proxy setup for us.

Implement a new stream which uses libcurl instead of raw sockets or the
TLS libraries directly. This version does not support reporting
certificates or proxies yet.
2015-06-24 17:25:05 +02:00
Carlos Martín Nieto
cf9d5f7602 curl: find and link with the library if it's available by default 2015-06-24 17:25:05 +02:00
Edward Thomson
aacfd03dba Merge pull request #3251 from git-up/fixes
Fixes
2015-06-24 00:30:19 -04:00
Pierre-Olivier Latour
6a8f3fa850 Fixed invalid error handling in git_repository_open_ext() 2015-06-23 20:59:03 -07:00
Pierre-Olivier Latour
8113056c7a Fixed Xcode 6.1 build warnings 2015-06-23 20:57:09 -07:00
Edward Thomson
cc605e73ac Merge pull request #3222 from git-up/conflicted
Fixed GIT_DELTA_CONFLICTED not returned in some cases
2015-06-23 23:52:03 -04:00
Edward Thomson
09f3364d7a Merge pull request #3131 from urkud/const-char
Add `const` qualifier
2015-06-23 23:40:02 -04:00
Edward Thomson
bd670abd23 Merge pull request #3226 from libgit2/cmn/racy-diff-again
racy-git, the missing link
2015-06-23 23:30:58 -04:00
Edward Thomson
8351abc782 Merge pull request #3249 from libgit2/cmn/repo-version-check
Check the repository version
2015-06-23 23:17:18 -04:00
Carlos Martín Nieto
16c73d3804 repository: check the format version
This is something we do on re-init but not when opening a
repository. This hasn't particularly mattered up to now as the version
has been 0 ever since the first release of git, but the times, they're
a-changing and we will soon see version 1 in the wild. We need to make
sure we don't open those.
2015-06-23 20:44:27 +02:00
Carlos Martín Nieto
99e11cdd02 repository: don't error out if there is no version
git will assume the repository format version is 0 if the value is not
there. Do the same.
2015-06-23 20:43:49 +02:00
Pierre-Olivier Latour
8d8a2eefef Fixed GIT_DELTA_CONFLICTED not returned in some cases
If an index entry for a file that is not in HEAD is in conflicted state,
when diffing HEAD with the index, the status field of the corresponding git_diff_delta was incorrectly reported as GIT_DELTA_ADDED instead of GIT_DELTA_CONFLICTED.

This was due to handle_unmatched_new_item() initially setting the status
to GIT_DELTA_CONFLICTED but then overriding it later with GIT_DELTA_ADDED.
2015-06-23 07:48:26 -07:00
Carlos Martín Nieto
0c34fa5094 Merge pull request #3228 from git-up/diff_merge
Explicitly handle GIT_DELTA_CONFLICTED in git_diff_merge()
2015-06-23 14:08:20 +02:00
Pierre-Olivier Latour
cb63e7e897 Explicitly handle GIT_DELTA_CONFLICTED in git_diff_merge()
This fixes a bug where if a file was in conflicted state in either diff,
it would not always remain in conflicted state in the merged diff.
2015-06-22 21:37:41 -07:00
Carlos Martín Nieto
91c1833af1 Merge pull request #3199 from ethomson/crlf
CRLF
2015-06-22 19:44:05 +02:00
Edward Thomson
146d0d084e crlf: give Unix the glory of autocrlf=true
Perform LF->CRLF for core.autocrlf=true on non-Win32 because core
git does.
2015-06-22 12:00:30 -04:00
Edward Thomson
1e46d54584 crlf tests: ensure that Unix obeys autocrlf=true
All platforms do terrible, horrible, no good, very bad translation
when core.autocrlf=true.  It's not just Windows!
2015-06-22 12:00:26 -04:00
Edward Thomson
8293c8f9a3 git_buf_text_lf_to_crlf: allow mixed line endings
Allow files to have mixed line endings instead of skipping processing
on them.
2015-06-22 12:00:23 -04:00
Edward Thomson
47e9a6cb05 crlf: use statistics to control to workdir filter
Use statistics (like core git) to control the behavior of the
to workdir CRLF filter.
2015-06-22 12:00:19 -04:00
Edward Thomson
71686ddca6 clar: support hierarchical test resource data
Support hierarchical test resource data, such that you can have
`tests/resources/foo/bar` and move the `bar` directory in as
a fixture.

Calling `cl_fixture_sandbox` on a path that is not directly beneath
the test resources directory succeeds, placing that directory into
the test fixture.  (For example, `cl_fixture_sandbox("foo/bar")`
will sandbox the `foo/bar` directory as `bar`).

Add support for cleaning up directories created this way, by only
cleaning up the basename (in this example, `bar`) from the fixture
directory.
2015-06-22 12:00:15 -04:00
Edward Thomson
e774fa6c0b crlf tests: posix known-good data
A corpus of files checked out with Git (Linux, 1.9.1) to ensure that
produce identical data when checking out using a CRLF filter.
2015-06-22 12:00:11 -04:00
Edward Thomson
4ebe320a31 crlf tests: windows known-good data
A corpus of files checked out with Git for Windows (2.4.1.windows.1)
to ensure that we produce identical data when checking out using a
CRLF filter.
2015-06-22 12:00:06 -04:00
Edward Thomson
3d92b9abaa crlf tests: use known-good data produced by git
Given a variety of combinations of core.autocrlf settings and
attributes settings, test that we check out data into the working
directory the same as a known-good test resource created by git.git.
2015-06-22 12:00:02 -04:00
Edward Thomson
bf8c0a9b91 crlf: script to generate expected crlf data
Include a shell script that will generate the expected CRLF data,
calling git.git to capture its output as a test resource for the
current platform.
2015-06-22 11:59:58 -04:00
Edward Thomson
bd5e59ee72 crlf: include utf8 resources in master branch
Include the UTF8 and UTF8 BOM tests in the master crlf test
branch for completeness.
2015-06-22 11:59:54 -04:00
Edward Thomson
84f8f50046 crlf: include additional test resources
Include additional test data for CRLF tests: files with mixed
line endings and binary files.
2015-06-22 11:59:50 -04:00
Edward Thomson
0b6ed4f96c Merge pull request #3240 from libgit2/cmn/commit-header-field
commit: allow retrieving an arbitrary header field
2015-06-22 11:24:20 -04:00
Carlos Martín Nieto
0c94deb90f Merge pull request #3239 from git-up/stash_index
Write modified index in git_stash_apply()
2015-06-22 16:58:14 +02:00
Carlos Martín Nieto
bb4896f22c Add a note about racy-git in CHANGELOG 2015-06-22 16:11:58 +02:00
Carlos Martín Nieto
6e611f7c3c index: add a diff test for smudging a file which becomes empty
Even though the file is empty and thus the size in the entry matches, we
should be able to detect it as a difference.
2015-06-22 16:11:58 +02:00
Carlos Martín Nieto
27133caf3c tests: move racy tests to the index
They fit there much better, even though we often check by diffing, it's
about the behaviour of the index.
2015-06-22 16:11:58 +02:00
Carlos Martín Nieto
5b05f95424 merge: work around write-side racy protection when hacking the index
As we attempt to replicate a situation in which an older checkout has
put a file on disk with different filtering settings from us, set the
timestamp on the entry and file to a second before we're performing the
operation so the entry in the index counts as old.

This way we can test that we're not looking at the on-disk file when the
index has the entry and we detect it as clean.
2015-06-22 16:11:58 +02:00
Carlos Martín Nieto
a3f42fe8e4 commit: allow retrieving an arbitrary header field
This allows the user to look up fields which we don't parse in libgit2,
and allows them to access gpgsig or mergetag fields if they wish to
check the signature.
2015-06-22 15:56:31 +02:00
Carlos Martín Nieto
26432a9c62 tests: set racy times manually 2015-06-22 12:47:30 +02:00
Carlos Martín Nieto
6c5eaead49 tests: plug leaks in the racy test 2015-06-22 12:47:30 +02:00
Carlos Martín Nieto
7497584651 index: check racily clean entries more thoroughly
When an entry has a racy timestamp, we need to check whether the file
itself has changed since we put its entry in the index. Only then do we
smudge the size field to force a check the next time around.
2015-06-22 12:47:30 +02:00
Carlos Martín Nieto
ff47537557 diff: check files with the same or newer timestamps
When a file on the workdir has the same or a newer timestamp than the
index, we need to perform a full check of the contents, as the update of
the file may have happened just after we wrote the index.

The iterator changes are such that we can reach inside the workdir
iterator from the diff, though it may be better to have an accessor
instead of moving these structs into the header.
2015-06-22 12:47:30 +02:00
Pierre-Olivier Latour
e35b947bec Write modified index in git_stash_apply()
Same as with git_stash_save(), there's no reason not to write the index
to disk since it has been modified.
2015-06-21 01:06:20 -07:00
Carlos Martín Nieto
e96a97f18e Merge pull request #3233 from ethomson/status_typechange
Don't propagate workdir's mode to the index during diff's update index
2015-06-20 23:17:42 +02:00
Edward Thomson
96dd171e34 diff: preserve original mode in the index
When updating the index during a diff, preserve the original mode,
which prevents us from dropping the mode to what we have interpreted
as on our system (eg, what the working directory claims it to be,
which may be a lie on some systems.)
2015-06-20 15:37:32 -04:00
Edward Thomson
fc6568021c status: test that symlinks don't lose their mode
Test to ensure that when status updates an index, it does not alter
the original mode for file types that are not supported (eg, symlinks
on Windows).
2015-06-20 15:37:32 -04:00
Edward Thomson
9018529b4e Merge pull request #3238 from git-up/double_free
Fixed index being double-freed in stash tests
2015-06-20 14:34:34 -04:00