Commit Graph

1488 Commits

Author SHA1 Message Date
Carlos Martín Nieto
c327d5db8b transaction: rename lock() to lock_ref()
This leaves space for future expansion to locking other resources
without having to change the API for references.
2014-10-09 16:29:30 +02:00
Carlos Martín Nieto
db2f82630c transaction: add documentation 2014-09-30 15:52:13 +02:00
Carlos Martín Nieto
ab8d9242f5 Introduce reference transactions
A transaction allows you to lock multiple references and set up changes
for them before applying the changes all at once (or as close as the
backend supports).

This can be used for replication purposes, or for making sure some
operations run when the reference is locked and thus cannot be changed.
2014-09-30 15:44:32 +02:00
Carlos Martín Nieto
20363d583c reflog: constify byindex 2014-09-30 15:44:32 +02:00
Vicent Marti
1312f87b68 Merge pull request #2464 from libgit2/cmn/host-cert-info
Provide a callback for certificate validation
2014-09-17 14:56:39 +02:00
Carlos Martín Nieto
1e0aa105fa ssh: expose both hashes
The user may have the data hashed as MD5 or SHA-1, so we should provide
both types for consumption.
2014-09-16 17:02:33 +02:00
Carlos Martín Nieto
286369a81f ssh: provide our own types for host key lengths
Instead of using the libssh2 defines, provide our own, which eases usage
as we do not need to check whether libgit2 was built with libssh2 or not.
2014-09-16 17:02:32 +02:00
Carlos Martín Nieto
0782fc43f8 net: use only structs to pass information about cert
Instead of spreading the data in function arguments, some of which
aren't used for ssh and having a struct only for ssh, use a struct for
both, using a common parent to pass to the callback.
2014-09-16 17:02:32 +02:00
Carlos Martín Nieto
0fef38999a Merge remote-tracking branch 'upstream/master' into cmn/host-cert-info 2014-09-16 17:02:28 +02:00
Carlos Martín Nieto
41698f22f6 net: remove support for outright ignoring certificates
This option make it easy to ignore anything about the server we're
connecting to, which is bad security practice. This was necessary as we
didn't use to expose detailed information about the certificate, but now
that we do, we should get rid of this.

If the user wants to ignore everything, they can still provide a
callback which ignores all the information passed.
2014-09-16 17:01:32 +02:00
Carlos Martín Nieto
2aee4642ef transport: move the cert type enum to types.h
This should make the mingw compiler happy.
2014-09-16 17:01:32 +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
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
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
Vicent Marti
89e05e2ab1 Merge pull request #2543 from libgit2/cmn/known-transports
Clean up transport lookup
2014-09-03 12:50:44 +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
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
Vicent Marti
46a13f3247 Merge pull request #2481 from libgit2/cmn/oidarray
merge: expose multiple merge bases
2014-08-29 18:19:56 +02:00
Carlos Martín Nieto
6a0d2b43ee Merge remote-tracking branch 'upstream/master' into cmn/ssh-retry 2014-08-27 15:09:07 +02:00
Vicent Marti
d28b2b7a5f Merge pull request #2528 from libgit2/vmg/tostr_s
Export `git_oid_tostr_s` instead of `_allocfmt`
2014-08-18 15:18:59 +02:00
Vicent Marti
4ca0b566ca oid: Export git_oid_tostr_s instead of _allocfmt
The old `allocfmt` is of no use to callers, as they are not able to free
the returned buffer. Export a new API that returns a static string that
doesn't need to be freed.
2014-08-18 12:41:06 +02:00
Edward Thomson
c180c06586 Custom transport: minor cleanups
* Move the transport registration mechanisms into a new header under
   'sys/' because this is advanced stuff.
 * Remove the 'priority' argument from the registration as it adds
   unnecessary complexity.  (Since transports cannot decline to operate,
   only the highest priority transport is ever executed.)  Users who
   require per-priority transports can implement that in their custom
   transport themselves.
 * Simplify registration further by taking a scheme (eg "http") instead
   of a prefix (eg "http://").
2014-08-14 08:52:20 -05:00
Carlos Martín Nieto
7db0e6ee48 merge: expose multiple merge bases
We always calculate multiple merge bases, but up to now we had only
exposed the "best" merge base.

Introduce git_oidarray which analogously to git_strarray lets us return
multiple ids.
2014-07-27 17:17:22 +02:00
Vicent Marti
243db06ce3 Merge pull request #2484 from libgit2/fix-git-status-list-new-unreadable-folder
Fix git status list new unreadable folder
2014-07-23 07:57:20 +02:00
Edward Thomson
0ba4dca526 git_cherry_pick -> git_cherrypick 2014-07-22 10:40:23 -04:00
Alan Rogers
7d0ab0fae0 Merge remote-tracking branch 'origin/master' into fix-git-status-list-new-unreadable-folder 2014-07-22 15:08:24 +10:00
Alan Rogers
35b1471f01 Move the UNREADABLE enums to the correct group. 2014-07-22 11:17:42 +10:00
joshaber
b3af2d80d2 Just put it all in buffer. 2014-07-16 13:34:25 -07:00
joshaber
df4cba0f28 Export git_buf_text_is_binary and git_buf_text_contains_nul.
So that users don’t need to implement binary detection themselves.
2014-07-15 17:38:39 -07:00
Vicent Marti
44cfb6f387 Merge pull request #2463 from libgit2/cmn/ssh-factory-for-paths
ssh: provide a factory function for setting ssh paths
2014-07-11 16:49:23 +02:00
Carlos Martín Nieto
eb5f03461f checkout: fix docs formatting for the options 2014-07-11 12:22:48 +02:00
Alan Rogers
4edd1a036b Merge remote-tracking branch 'origin/development' into fix-git-status-list-new-unreadable-folder 2014-07-10 19:17:34 -07:00
Carlos Martín Nieto
18eb6ec823 Documentation fixes
Fixup git_attr_value's comment to be recognised as documentation, and
include the definitions needed for clang to parse reset.h such that
it shows up in the documentation.

This fixes #2430.
2014-07-08 10:30:19 +02:00
Carlos Martín Nieto
d4256ed554 ssh: provide a factory function for setting ssh paths
git allows you to set which paths to use for the git server programs
when connecting over ssh; and we want to provide something similar.

We do this by providing a factory function which can be set as the
remote's transport callback which will set the given paths upon
creation.
2014-07-07 14:51:51 +02:00
Jacques Germishuys
268dafa260 Fix git_cred_ssh_interactive_callback signature 2014-07-03 20:19:16 +02:00
Vicent Marti
cb6e68c7e6 Merge pull request #2449 from libgit2/cmn/maint-21
Maint fixes for ssl initing and ssh exposure
2014-07-02 16:45:02 +02:00
Carlos Martín Nieto
6812afaf38 clone: remote git_clone_into{,_local} from the public API
As git_clone now has callbacks to configure the details of the
repository and remote, remove the lower-level functions from the public
API, as they lack some of the logic from git_clone proper.
2014-07-02 07:05:00 +02:00
Carlos Martín Nieto
d58a64e9a5 clone: add a callback for repository creation
Analogously to the remote creation callback, provide a way for the user
of git_clone() to create the repository with whichever options they
desire via callback.
2014-07-02 07:05:00 +02:00
Carlos Martín Nieto
00b8c216c2 ssh: always declare the libssh2 types
This lets a user decide they do want to use keyboard-interactive after
they've compiled.
2014-06-30 23:27:20 +02:00
Carlos Martín Nieto
eac63e6754 ssh: create the right callback signature based on build options
When linking against libssh2, create the transport.h such that it
contains its definition for custom crypto and keyboard-interactive
callbacks.

If we don't link against libssh2, create an equivalent signature which
has void pointers instead of pointers to libssh2 structures.

This would be one way to fix #2438.
2014-06-30 10:03:36 +02:00
Philip Kelley
1697cd6ff5 Improvements to git_transport extensibility
git_remote_set_transport now takes a transport factory rather than a transport
git_clone_options now allows the caller to specify a remote creation callback
2014-06-26 22:34:37 -04:00
Carlos Martín Nieto
d1c281a552 cred: add convenience function to get the username
Since each cred defines the username on their own, introduce
git_cred__username to retrieve the username pointer from them.
2014-06-26 22:58:38 +02:00
Carlos Martín Nieto
54da69588e cred: introduce username-only cred
This exists as ssh needs to know about the username to use before it can
query for the supported authentication methods.
2014-06-26 22:58:38 +02:00
Carlos Martín Nieto
8873728f37 Introduce GIT_EAUTH
Introduce this error code to signal an authentication failure.
2014-06-26 22:58:38 +02:00
Edward Thomson
4e813a8b60 Export git_revert_commit 2014-06-25 09:11:16 -04:00
Carlos Martín Nieto
5e37874dd4 Merge remote-tracking branch 'upstream/cmn/treebuilder-perf' 2014-06-24 17:51:45 +02:00
Carlos Martín Nieto
76f76162b2 remote: update documentation
Add docs for git_clone_local_t and move the docs for the
git_clone_options to each field.
2014-06-11 21:20:23 +02:00
Carlos Martín Nieto
978fbb4c34 treebuilder: don't keep removed entries around
If the user wants to keep a copy for themselves, they should make a
copy. It adds unnecessary complexity to make sure the returned entries
are valid until the builder is cleared.
2014-06-10 15:14:13 +02:00
Carlos Martín Nieto
4d3f1f9740 treebuilder: use a map instead of vector to store the entries
Finding a filename in a vector means we need to resort it every time we
want to read from it, which includes every time we want to write to it
as well, as we want to find duplicate keys.

A hash-map fits what we want to do much more accurately, as we do not
care about sorting, but just the particular filename.

We still keep removed entries around, as the interface let you assume
they were going to be around until the treebuilder is cleared or freed,
but in this case that involves an append to a vector in the filter case,
which can now fail.

The only time we care about sorting is when we write out the tree, so
let's make that the only time we do any sorting.
2014-06-10 15:14:13 +02:00