Commit Graph

31 Commits

Author SHA1 Message Date
Carlos Martín Nieto
25abbc27a7 Clean up some leaks in the test suite 2014-09-17 03:19:40 +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
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
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
94412b009e remote: assert what we want to happen when ther is no default branch
Assert what we already do, so as to notice changes.
2014-08-29 15:28:10 +02:00
Jacques Germishuys
dc8adda4f1 git_remote_ls() should return an error if the transport is not available 2014-08-15 22:56:15 +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
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
eb6aa791a7 remote: failing test for renaming with a symref 2014-06-06 22:36:41 +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
fe3b9d0731 remote: failing test for rename
When there is a reference in the target namespace, we should overwrite
it. Instead it gets a different name under the current code.
2014-06-06 00:54:11 +02:00
Arthur Schreiber
d723dbed0c Remote: Set an error when a remote cannot be found.
Inside `git_remote_load`, the calls to `get_optional_config` use
`giterr_clear` to unset any errors that are set due to missing config
keys. If neither a fetch nor a push url config was found for a remote,
we should set an error again.
2014-05-30 19:26:49 +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
Carlos Martín Nieto
ec8a949a58 remote: remove remote-tracking branches on delete
When we delete a remote, we also need to go through its fetch refspecs
and remove the references they create locally.
2014-05-16 10:02:07 +02:00
nulltoken
40e48ea40f remote: Introduce git_remote_delete() 2014-04-30 11:45:49 +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
Ben Straub
db55bb73ff Correct default reflog message for git_remote_fetch 2014-02-06 11:18:10 -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
Edward Thomson
96f12e709b Don't strcmp a git_buf, strcmp its char * 2014-01-29 12:50:42 -08:00
Vicent Marti
46e7fc1853 Merge pull request #2077 from libgit2/cmn/buf-out
Buff up returning strings
2014-01-27 09:36:24 -08:00
Carlos Martín Nieto
66d585c6b3 MSVC doesn't like modern code 2014-01-27 04:58:23 +01:00
Carlos Martín Nieto
bf522e0811 refspec: move to git_buf for outputting strings 2014-01-27 04:44:06 +01:00
Arthur Schreiber
991b2840eb Make sure git_remote_dup copies a remote's refspecs correctly. 2014-01-26 19:35:02 +01:00
Graham Dennis
c7015424cc Fix a compile warning. 2014-01-18 08:54:19 +11:00
Graham Dennis
194d077c4f Add test for pushing to a local file:// URL. 2014-01-18 08:43:29 +11:00
Arthur Schreiber
40ef47dd46 Add git_remote_dup. 2014-01-14 21:03:01 +01:00
Ben Straub
1782038144 Rename tests-clar to tests 2013-11-14 14:05:52 -08:00