Commit Graph

144 Commits

Author SHA1 Message Date
Carlos Martín Nieto
209425ce26 remote: rename _load() to _lookup()
This brings it in line with the rest of the lookup functions.
2014-11-08 13:28:27 +01:00
Edward Thomson
725cd5f29d Merge pull request #2646 from libgit2/cmn/remote-rename
remote: accept a repo and name for renaming
2014-10-24 16:44:07 -07:00
Carlos Martín Nieto
46c8f7f845 remote: accept a repo and name for renaming
Remote objects are not meant to be changed from under the user. We did
this in rename, but only the name and left the refspecs, such that a
save would save the wrong refspecs (and a fetch and anything else would
use the wrong refspecs).

Instead, let's simply take a name and not change any loaded remote from
under the user.
2014-10-24 16:25:59 +02:00
Carlos Martín Nieto
0862f617da remote: delete git_remote_supported_url()
This function does not in fact tell us anything, as almost anything with
a colon in it is a valid rsync-style SSH path; it can not tell us that
we do not support ftp or afp or similar as those are still valid SSH
paths and we do support that.
2014-10-24 13:40:42 +02:00
Edward Thomson
a6ed1fcbe1 Merge pull request #2593 from libgit2/cmn/remote-delete-name
remote: accept a repository and remote name for deletion
2014-10-10 12:21:28 -04:00
Arthur Schreiber
8e398e4c84 Treat an empty list of refspecs the same as a NULL value. 2014-10-10 13:17:53 +02:00
Carlos Martín Nieto
262eec23fe remote: accept a repository and remote name for deletion
We don't need the remote loaded, and the function extracted both of
these from the git_remote in order to do its work, so let's remote a
step and not ask for the loaded remote at all.

This fixes #2390.
2014-09-30 16:09:55 +02:00
Carlos Martín Nieto
3f89420523 remote: allow overriding the refspecs for download and fetch
With opportunistic ref updates, git has introduced the concept of having
base refspecs *and* refspecs that are active for a particular fetch.

Let's start by letting the user override the refspecs for download.
2014-09-30 15:42: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
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
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
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
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
281da0043c remote: fix rename docs 2014-06-09 19:35:41 +02:00
Carlos Martín Nieto
231f350d91 remote: don't free the remote on delete
This was a bad idea. Don't free except in the free function.
2014-06-06 22:55:34 +02:00
Carlos Martín Nieto
72bca13e5d remote: return problem refspecs instead of using a callback
There is no reason why we need to use a callback here. A string array
fits better with the usage, as this is not an event and we don't need
anything from the user.
2014-06-06 21:43:04 +02:00
Carlos Martín Nieto
d22db24fb7 remote: add api to guess the remote's default branch
If the remote supports the symref protocol extension, then we return
that, otherwise we guess with git's rules.
2014-05-21 12:12:32 +02:00
Vicent Marti
228272ef58 Merge pull request #2313 from libgit2/cmn/remote-delete
Remote deletion
2014-05-16 11:56:37 +02:00
Russell Belfer
bc91347b58 Fix remaining init_options inconsistencies
There were a couple of "init_opts()" functions a few more cases
of structure initialization that I somehow missed.
2014-05-02 09:21:33 -07:00
nulltoken
40e48ea40f remote: Introduce git_remote_delete() 2014-04-30 11:45:49 +02:00
Vicent Marti
8443ed6c1d Merge pull request #2284 from jacquesg/push-progress-callback
Fire progress and update tips callbacks also for pushes.
2014-04-25 02:10:19 -07:00
Carlos Martín Nieto
bc0a619867 transports: allow the creds callback to say it doesn't exist
Allow the credentials callback to return GIT_PASSTHROUGH to make the
transports code behave as though none was set.

This should make it easier for bindings to behave closer to the C code
when there is no credentials callback set at their level.
2014-04-22 14:34:26 +02:00
Carlos Martín Nieto
2efd7df6b1 remote: provide read access to the callback structure
This should make it easier for bindings to dynamically override their
own callbacks.
2014-04-22 14:32:19 +02:00
Jacques Germishuys
48e60ae75e Don't redefine the same callback types, their signatures may change 2014-04-21 11:28:49 +02:00
Jacques Germishuys
98020d3a73 Rename progress callback to sideband_progress 2014-04-21 10:55:37 +02:00
Jacques Germishuys
4f62163ead Check the return codes of remote callbacks.
The user may have requested that the operation be cancelled.
2014-04-21 10:24:16 +02:00
Jacques Germishuys
9effa2fb72 Fire progress callbacks also for pushes.
It's not very useful to only know that a pre-receive hook has declined
a push, you probably want to know why.
2014-04-20 22:06:45 +02:00
Carlos Martín Nieto
fd536d29c1 remote: rename inmemory to anonymous and swap url and fetch order
The order in this function is the opposite to what
create_with_fetchspec() has, so change this one, as url-then-refspec is
what git does.

As we need to break compilation and the swap doesn't do that, let's take
this opportunity to rename in-memory remotes to anonymous as that's
really what sets them apart.
2014-04-01 13:38:04 +02:00
Matthew Bowen
b9f819978c Added function-based initializers for every options struct.
The basic structure of each function is courtesy of arrbee.
2014-03-05 21:49:23 -05:00
Ben Straub
db55bb73ff Correct default reflog message for git_remote_fetch 2014-02-06 11:18:10 -08:00
Ben Straub
2bfc673910 Fix terrible indentation 2014-02-06 10:39:57 -08:00
Ben Straub
c3ab1e5af4 Add reflog parameters to remote apis
Also added a test for git_remote_fetch.
2014-02-04 20:38:13 -08:00
Arthur Schreiber
991b2840eb Make sure git_remote_dup copies a remote's refspecs correctly. 2014-01-26 19:35:02 +01:00
Arthur Schreiber
11f6ad5fcf Add some missing const declarations. 2014-01-26 18:08:05 +01:00
Arthur Schreiber
40ef47dd46 Add git_remote_dup. 2014-01-14 21:03:01 +01:00
Vicent Martí
7b947bf5cc Merge pull request #1951 from victorgp/create-remote-plus-fetch
Allowing create remotes with custom fetch spec
2013-11-14 07:21:47 -08:00
Carlos Martín Nieto
359dce726d remote: make _ls return the list directly
The callback-based method of listing remote references dates back to the
beginning of the network code's lifetime, when we didn't know any
better.

We need to keep the list around for update_tips() after disconnect() so
let's make use of this to simply give the user a pointer to the array so
they can write straightforward code instead of having to go through a
callback.
2013-11-11 15:35:51 +01:00
Carlos Martín Nieto
266af6d819 remote: don't allow such direct access to the refspecs
Removing arbitrary refspecs makes things more complex to reason
about. Instead, let the user set the fetch and push refspec list to
whatever they want it to be.
2013-11-10 22:21:25 +01:00
Victor Garcia
886cc44738 fixing typo 2013-11-08 15:42:52 +01:00
Victor Garcia
40b99d05b4 splitting funcionality in two methods to avoid ambiguity with NULL 2013-11-08 12:14:31 +01:00
Victor Garcia
99feb98897 adding doc for new param and test to check fetch spec is correctly added 2013-11-07 16:22:49 +01:00
Victor Garcia
0fe522d105 allowing create remote with custom fetch spec 2013-11-07 14:16:20 +01:00
Carlos Martín Nieto
2f03050f4f remote: download HEAD when no refspecs are given
The correct behaviour when a remote has no refspecs (e.g. a URL from the
command-line) is to download the remote's HEAD. Let's do that.

This fixes #1261.
2013-11-01 22:47:06 +01:00
Carlos Martín Nieto
97d32abb49 Remove leftover function declaration 2013-10-30 15:15:54 +01:00
Carlos Martín Nieto
5cb136705d transport: let the progress output return an error
There are any number of issues that can come up in the progress
callback, and we should let the user cancel at that point as well.
2013-10-23 15:45:29 +02:00
Carlos Martín Nieto
0e0cf78773 clone: put the callbacks struct directly in the clone options
There's no need for this to be a pointer to somewhere else.
2013-10-02 14:04:44 +02:00
Carlos Martín Nieto
ffc97d5126 remote: add some comments to the callback struct
Hopefully clear up what they're for.
2013-10-02 06:42:27 +02:00
Carlos Martín Nieto
fe3a40a4ff remote: add a convenience 'fetch' function. 2013-10-02 06:41:42 +02:00
Carlos Martín Nieto
e3c131c544 remote: move the credentials callback to the struct
Move this one as well, letting us have a single way of setting the
callbacks for the remote, and removing fields from the clone options.
2013-10-02 06:41:42 +02:00