Commit Graph

7209 Commits

Author SHA1 Message Date
Carlos Martín Nieto
7c8acc54be winhttp: set ignore security flags on user command
If the user returns 0 from the certificate check and we had certificate issues, set the options to ignore certificate errors and resend the request.
2014-09-16 17:01:32 +02:00
Carlos Martín Nieto
67c84e06f3 winhttp: bring together request sending
We need to call WinHttpSendRequest() in three different places. Unify all in a single function to have a single place for the certificate check.
2014-09-16 17:01:31 +02:00
Carlos Martín Nieto
5f2cf732ab winhttp: only do certificate check for SSL
If we're not using SSL, don't call the user's certificate check callback.
2014-09-16 17:01:31 +02:00
Carlos Martín Nieto
08545d366b winhttp: credential check on successful connect
On successful connection, still ask the user whether they accept the server's certificate, indicating that WinHTTP would let it though.
2014-09-16 17:01:31 +02:00
Carlos Martín Nieto
23ca0ad5eb Bring certificate check back to the normal return code
Returning 0 lets the certificate check succeed. An error code is bubbled
up to the user.
2014-09-16 17:01:31 +02:00
Carlos Martín Nieto
2f5864c50c ssh: do ssh cert info before asking for credentials
We know the host's key as soon as we connect, so we should perform the
check as soon as we can, before we bother with the user's credentials.
2014-09-16 17:01:31 +02:00
Carlos Martín Nieto
17491f6e56 transport: always call the certificate check callback
We should let the user decide whether to cancel the connection or not
regardless of whether our checks have decided that the certificate is
fine. We provide our own assessment to the callback to let the user fall
back to our checks if they so desire.
2014-09-16 17:01:30 +02:00
Carlos Martín Nieto
85acc56262 remote: add tests for the certificate callback 2014-09-16 17:01:30 +02:00
Carlos Martín Nieto
ec1ce4584a http: send the DER-encoded cert to the callback
Instead of the parsed data, we can ask OpenSSL to give us the
DER-encoded version of the certificate, which the user can then parse
and validate.
2014-09-16 17:01:30 +02:00
Carlos Martín Nieto
9b9405865e Provide a callback for certificate validation
If the certificate validation fails (or always in the case of ssh),
let the user decide whether to allow the connection.

The data structure passed to the user is the native certificate
information from the underlying implementation, namely OpenSSL or
WinHTTP.
2014-09-16 17:01:30 +02:00
Vicent Marti
73dd663876 Merge pull request #2565 from linquize/typo
Fix typo
2014-09-16 13:24:52 +02:00
Vicent Marti
903a76168e Merge pull request #2561 from jacquesg/merge-skip
No files merged may result in bogus merge conflict error
2014-09-16 13:22:40 +02:00
The rugged tests are fragile
52e9120c77 attr: Cleanup the containing dir logic 2014-09-16 13:20:58 +02:00
Vicent Marti
6259576408 Merge pull request #2566 from libgit2/rb/attr-with-bare
Fix attribute lookup in index for bare repos
2014-09-16 13:17:08 +02:00
Ciro Santilli
3b2cb2c91e Factor 40 and 41 constants from source. 2014-09-16 13:07:04 +02:00
Russell Belfer
1fbeb2f04c Fix attribute lookup in index for bare repos
When using a bare repo with an index, libgit2 attempts to read
files from the index.  It caches those files based on the path
to the file, specifically the path to the directory that contains
the file.

If there is no working directory, we use `git_path_dirname_r` to
get the path to the containing directory.  However, for the
`.gitattributes` file in the root of the repository, this ends up
normalizing the containing path to `"."` instead of the empty
string and the lookup the `.gitattributes` data fails.

This adds a test of attribute lookups on bare repos and also
fixes the problem by simply rewriting `"."` to be `""`.
2014-09-15 21:59:23 -07:00
Linquize
2c22193ba0 Fix typo 2014-09-16 08:56:33 +08:00
Vicent Marti
910cd2daa6 Merge pull request #2563 from alexcrichton/rust-bindings
Add Rust to the language bindings list
2014-09-15 21:28:12 +02:00
Alex Crichton
b4913705fb Add Rust to the language bindings list 2014-09-15 12:11:48 -07:00
Vicent Marti
a7fcac13a5 Merge pull request #2554 from linquize/fetch-head-tag
When auto follow tags, FETCH_HEAD should list only newly followed tags
2014-09-15 20:26:12 +02:00
Carlos Martín Nieto
fdea219a86 global: free the error message when exiting a thread
When we free the global state at thread termination, we must also free
the error message in order not to leak the string once per thread.
2014-09-14 00:39:07 +02:00
Jacques Germishuys
dc68ee8d15 Remove local unused index_repo variable 2014-09-12 22:54:05 +02:00
Jacques Germishuys
a565f364ab Only check for workdir conflicts if the index has merged files
Passing 0 as the length of the paths to check to git_diff_index_to_workdir
results in all files being treated as conflicting, that is, all untracked or
modified files in the worktree is reported as conflicting
2014-09-12 22:53:56 +02:00
Jacques Germishuys
493c340cef Added test case to illustrate bogus conflicts detected if no files were merged, and untracked files exist in the workdir. 2014-09-12 22:01:22 +02:00
Vicent Marti
3a495c19bd Merge pull request #2558 from libgit2/cmn/signature-empty-email
signature: don't allow empty emails
2014-09-10 18:32:51 +02:00
Carlos Martín Nieto
76e3c43fb9 signature: don't allow empty emails
A signature is made up of a non-empty name and a non-empty email so
let's validate that. This also brings us more in line with git, which
also rejects ident with an empty email.
2014-09-10 18:14:46 +02:00
Vicent Marti
31e752b654 Merge pull request #2511 from libgit2/cmn/remote-default-restrict
Restrict which refs can be the default branch
2014-09-09 12:52:36 +02:00
Linquize
d908351a6c When auto follow tags, FETCH_HEAD should list only newly followed tags 2014-09-06 00:26:56 +08:00
Vicent Marti
1e71354e34 reflog: Error handling on empty reflog 2014-09-05 03:25:53 +02:00
Vicent Marti
0972443c47 Merge pull request #2553 from libgit2/cmn/ssh-errors
ssh: store error message immediately after a failed agent call
2014-09-05 02:50:11 +02:00
Carlos Martín Nieto
2dc399a81d ssh: store error message immediately after a failed agent call
When the call to the agent fails, we must retrieve the error message
just after the function call, as other calls may overwrite it.

As the agent authentication is the only one which has a teardown and
there does not seem to be a way to get the error message from a stored
error number, this tries to introduce some small changes to store the
error from the agent.

Clearing the error at the beginning of the loop lets us know whether the
agent has already set the libgit2 error message and we should skip it,
or if we should set it.
2014-09-04 16:46:14 +02:00
Vicent Marti
89e05e2ab1 Merge pull request #2543 from libgit2/cmn/known-transports
Clean up transport lookup
2014-09-03 12:50:44 +02:00
Vicent Marti
4c958046d3 Merge pull request #2530 from libgit2/jamill/relative_gitlink
Teach repository to use relative paths for git symbolic links
2014-09-03 12:19:48 +02:00
Vicent Marti
eb939c5772 Merge pull request #2552 from KindDragon/master
Several CppCat warnings fixed
2014-09-03 12:19:03 +02:00
Jameson Miller
bc737620dd Introduce option to use relative paths for repository work directory
Teach git_repository_init_ext to use relative paths for the gitlink
to the work directory. This is used when creating a sub repository
where the sub repository resides in the parent repository's
.git directory.
2014-09-02 21:07:26 -04:00
Edward Thomson
0ee9f31c3b Introduce git_path_make_relative 2014-09-02 21:07:23 -04:00
Vicent Marti
6f3082d90f Merge pull request #2550 from KindDragon/patch-2
.editorconfig added to repository
2014-09-03 00:15:47 +02:00
Vicent Marti
0ac9f9a0c7 Merge pull request #2545 from linquize/no-ssh
Skip SSH clone tests if libgit2 not built with GIT_SSH defined
2014-09-03 00:13:23 +02:00
Arkady Shapkin
5cd81bb3d8 Several CppCat warnings fixed 2014-09-03 01:01:25 +04:00
Arkadiy Shapkin
098bb9dfb9 .editorconfig added to repository 2014-09-03 00:19:02 +04:00
Carlos Martín Nieto
15c30b72e1 clone: handle overly restrictive refspecs
When the fetch refspec does not include the remote's default branch, it
indicates an error in user expectations or programmer error. Error out
in that case.

This lets us get rid of the dummy refspec which can never work as its
zeroed out. In the cases where we did not find a default branch, we set
HEAD detached immediately, which lets us refactor the "normal" path,
removing `found_branch`.
2014-09-02 13:23:54 +02:00
Carlos Martín Nieto
e128a1af6e clone: correct handling of an unborn HEAD
If the remote does not advertise HEAD, then it is unborn and we cannot
checkout that branch. Handle it the same way as an empty repo.
2014-09-02 13:10:19 +02:00
Carlos Martín Nieto
538f908175 remote: add test for single-branch clone
When cloning, we may be asking for a particular branch or subset of
branches. Make sure we test for that.
2014-09-02 12:47:12 +02:00
Carlos Martín Nieto
f2ffab618a remote: add tests for remote-branch edge cases
Add tests for the case when there are no branches on the remote and when
HEAD is detached but has the id of a non-branch. In both of these cases,
we should return ENOTFOUND.
2014-09-02 12:47:12 +02:00
Vicent Marti
d4cb23e4e5 Merge pull request #2548 from linquize/warning5
Fix warning
2014-09-01 18:29:54 +02:00
Linquize
bd465f9c22 Fix warning 2014-09-01 23:36:12 +08:00
Linquize
fe3b67891b Skip SSH clone tests if libgit2 not built with GIT_SSH defined 2014-09-01 19:18:20 +08:00
Carlos Martín Nieto
05ac70514f remote: test for supported URLs in a single place
Instead of using ifdefs to run the tests, use them to set when we expect
to support a particular scheme and always have the tests in the code.
2014-08-31 21:53:42 +02:00
Carlos Martín Nieto
ba67c07522 remote: get rid of git_remote_valid_url()
It does the same as git_remote_supported_url() but has a name which
implies we'd check the URL for correctness while we're simply looking at
the scheme and looking it up in our lists.

While here, fix up the tests so we check all the combination of what's
supported.
2014-08-31 21:50:28 +02:00
Carlos Martín Nieto
bd3854a09c transport: return ENOTFOUND for HTTPS and SSH when they're not supported
The previous commit makes it harder to figure out if the library was
built with support for a particular transport. Roll back some of the
changes and remove ssh:// and https:// from the list if we're being
built without support for them.
2014-08-31 18:01:44 +02:00