Commit Graph

8635 Commits

Author SHA1 Message Date
Carlos Martín Nieto
c2418f4613 Rename FALLBACK to UNSPECIFIED
Fallback describes the mechanism, while unspecified explains what the
user is thinking.
2015-06-25 12:48:44 +02:00
Carlos Martín Nieto
3cf91d98e2 Add CHANGELOG entries 2015-06-24 23:49:10 +02:00
Carlos Martín Nieto
a65992355d buffer: make use of EINVALID for growing a borrowed buffer
This explains more closely what happens. While here, set an error
message.
2015-06-24 23:49:10 +02:00
Carlos Martín Nieto
189aad45af errors: introduce EINVALID
We've been using EINVALIDSPEC for a while to mean this, but that name
is too specific. Introduce this to be more explicit.
2015-06-24 23:49:10 +02:00
Carlos Martín Nieto
bd470d0034 blob: don't recomment using git_buf_grow
We currently recommend using `git_buf_grow` in order to make a buffer
make an owned copy of the memory it points to. This is not behaviour we
should encourage, so remove this recommendation.

The function itself is not changed, as we need to remain compatible, but
it will be changed not to allow usage on borrowed buffers.
2015-06-24 23:49:10 +02:00
Carlos Martín Nieto
caab22c0d4 buffer: don't allow growing borrowed buffers
When we don't own a buffer (asize=0) we currently allow the usage of
grow to copy the memory into a buffer we do own. This muddles the
meaning of grow, and lets us be a bit cavalier with ownership semantics.

Don't allow this any more. Usage of grow should be restricted to buffers
which we know own their own memory. If unsure, we must not attempt to
modify it.
2015-06-24 23:49:10 +02:00
Carlos Martín Nieto
daacf96d10 Merge pull request #3097 from libgit2/cmn/submodule-config-state
Remove run-time configuration settings from submodules
2015-06-24 23:34:40 +02:00
Carlos Martín Nieto
e1f434f864 Merge pull request #3183 from libgit2/cmn/curl-stream
Implement a cURL stream
2015-06-24 23:33:46 +02:00
Carlos Martín Nieto
9d5efab89f Merge pull request #3254 from ethomson/diff-binary-patch
Handle binary DIFFABLEness properly
2015-06-24 21:13:23 +02:00
Carlos Martín Nieto
c2f274c69e Merge pull request #3250 from ethomson/stash
Stash workdir correctly when added in the index, modified in the workdir
2015-06-24 19:47:34 +02:00
Edward Thomson
54077091c8 diff: determine DIFFABLE-ness for binaries
Always set `GIT_DIFF_PATCH_DIFFABLE` for all files, regardless of
binary-ness, so that the binary callback is invoked to either
show the binary contents, or just print the standard "Binary files
differ" message.  We may need to do deeper inspection for binary
files where we have avoided loading the contents into a file map.
2015-06-24 12:06:41 -04:00
Edward Thomson
ba8fb7c46a diff::binary tests: empty diff when forced binary
Ensure that even when we're forcing a binary diff that we do not
assume that there *is* a diff.  There should be an empty diff for
no change.
2015-06-24 11:39:59 -04:00
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
Carlos Martín Nieto
76633215d1 binary diff: test that the diff and patch otputs are the same
We test the generation of the textual patch via the patch function,
which are just one of two possibilities to get the output.

Add a second patch generation via the diff function to make sure both
outputs are in sync.
2015-06-24 14:33:02 +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
Edward Thomson
9017711143 stash: save the workdir file when deleted in index
When stashing the workdir tree, examine the index as well.  Using
a mechanism similar to `git_diff_tree_to_workdir_with_index`
allows us to determine that a file was added in the index and
subsequently modified in the working directory.  Without examining
the index, we would erroneously believe that this file was
untracked and fail to include it in the working directory tree.

Use a slightly modified `git_diff_tree_to_workdir_with_index` in
order to avoid some of the behavior custom to `git diff`.  In
particular, be sure to include the working directory side of a
file when it was deleted in the index.
2015-06-23 19:15:16 -04:00
Edward Thomson
14304b0e87 stash tests: ensure we save the workdir file
Ensure that when a file is added in the index and subsequently
modified in the working directory, the stashed working directory
tree contains the actual working directory contents.
2015-06-23 18:17:24 -04:00
Edward Thomson
5ef43d41b0 git_diff__merge: allow pluggable diff merges 2015-06-23 16:48:50 -04:00
Edward Thomson
83ba5e3654 diff_tform: remove reversed copy of delta merger
Drop `git_diff__merge_like_cgit_reversed`, since it's a copy and
paste mess of slightly incompatible changes.
2015-06-23 16:48:46 -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