Commit Graph

32 Commits

Author SHA1 Message Date
Carlos Martín Nieto
07bd3e57d9 proxy: ask the user for credentials if necessary 2016-04-19 13:54:19 +02:00
Matt Burke
4f2b6093a6 Tell the git_transport about the custom_headers 2015-09-08 14:02:33 -04:00
Carlos Martín Nieto
ae5b93629c remote: remove fetch parameter from create_anonymous
An anonymous remote is not configured and cannot therefore have
configured refspecs. Remove the parameter which adds this from the
constructor.
2015-05-28 15:32:20 +02:00
Carlos Martín Nieto
0bc3d56dde tests: don't push to our resources
A couple of tests use the wrong remote to push to. We did not notice up
to now because the local push would copy individual objects, and those
already existed, so it became a no-op.

Once we made local push create the packfile, it became noticeable that
there was a new packfile where it didn't belong.
2015-05-13 10:56:37 +02:00
Carlos Martín Nieto
7725499072 remote: remove live changing of refspecs
The base refspecs changing can be a cause of confusion as to what is the
current base refspec set and complicate saving the remote's
configuration.

Change `git_remote_add_{fetch,push}()` to update the configuration
instead of an instance.

This finally makes `git_remote_save()` a no-op, it will be removed in a
later commit.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
35a8a8c546 remote: move the tagopt setting to the fetch options
This is another option which we should not be keeping in the remote, but
is specific to each particular operation.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
3eff2a5728 remote: move the update_fetchhead setting to the options
While this will rarely be different from the default, having it in the
remote adds yet another setting it has to keep around and can affect its
behaviour. Move it to the options.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
8f0104ecc5 Remove the callbacks struct from the remote
Having the setting be different from calling its actions was not a great
idea and made for the sake of the wrong convenience.

Instead of that, accept either fetch options, push options or the
callbacks when dealing with the remote. The fetch options are currently
only the callbacks, but more options will be moved from setters and
getters on the remote to the options.

This does mean passing the same struct along the different functions but
the typical use-case will only call git_remote_fetch() or
git_remote_push() and so won't notice much difference.
2015-05-13 09:46:35 +02:00
Carlos Martín Nieto
412a380888 push: remove reflog message override
We always use "update by push".
2015-03-03 14:40:50 +01:00
Carlos Martín Nieto
659cf2029f Remove the signature from ref-modifying functions
The signature for the reflog is not something which changes
dynamically. Almost all uses will be NULL, since we want for the
repository's default identity to be used, making it noise.

In order to allow for changing the identity, we instead provide
git_repository_set_ident() and git_repository_ident() which allow a user
to override the choice of signature.
2015-03-03 14:40:50 +01:00
Carlos Martín Nieto
fe794b2ea7 remote: remove git_push from the public API
Instead we provide git_remote_upload() and git_remote_update_tips() in
order to have a parallel API for fetching and pushing.
2014-12-30 17:02:50 +00:00
Carlos Martín Nieto
d524b2d3d1 push: fold unpack_ok() into finish()
The push cannot be successful if we sent a bad packfile. We should
return an error in that case instead of storing it elsewhere.
2014-12-10 18:55:54 +01:00
Linquize
d226fbf1aa Fix broken test suite on Windows 2014-12-07 22:42:06 +08:00
Carlos Martín Nieto
3fade40e39 remote: add test for pushing and deleting with the local transport 2014-11-23 21:29:35 +01:00
Carlos Martín Nieto
f7fcb18f8a Plug leaks
Valgrind is now clean except for libssl and libgcrypt.
2014-11-23 15:51:31 +01:00
Edward Thomson
8b5b814e55 Merge pull request #2671 from swisspol/remote_create_fix
Fixed active_refspecs field not initialized on new git_remote objects
2014-11-17 20:10:58 -05:00
Edward Thomson
7f1b73b7c8 Merge pull request #2693 from libgit2/cmn/push-refspec-refactor
push: use the common refspec parser
2014-11-17 17:03:55 -05:00
Pierre-Olivier Latour
d3cd7da51f Fixed active_refspecs field not initialized on new git_remote objects
When creating a new remote, contrary to loading one from disk,
active_refspecs was not populated. This means that if using the new
remote to push, git_push_update_tips() will be a no-op since it
checks the refspecs passed during the push against the base ones
i.e. active_refspecs. And therefore the local refs won't be created
or updated after the push operation.
2014-11-17 22:46:22 +09:00
Carlos Martín Nieto
aad638f3a1 push: use the common refspec parser
There is one well-known and well-tested parser which we should use,
instead of implementing parsing a second time.

The common parser is also augmented to copy the LHS into the RHS if the
latter is empty.

The expressions test had to change a bit, as we now catch a bad RHS of a
refspec locally.
2014-11-09 16:07:43 +01:00
Pierre-Olivier Latour
e284c451b0 Changed GIT_REMOTE_DOWNLOAD_TAGS_ALL to behave like git 1.9.0 2014-11-09 07:27:30 +09:00
Carlos Martín Nieto
ea8dedc953 remote: fix tagopt test
An anonymous remote wouldn't create remote-tracking branches, so testing
we don't create them for TAGS_ALL is nonsensical. Furthermore, the name
of the supposed remote-tracking branch was also not one which would have
been created had it had a name.

Give the remote a name and test that we only create the tags when we
pass TAGS_ALL and that we do create the remote-branch branch when given
TAGS_AUTO.
2014-11-02 20:39:29 +01:00
Carlos Martín Nieto
c5837cad85 remote: implement opportunistic remote-tracking branch updates
When a list of refspecs is passed to fetch (what git would consider
refspec passed on the command-line), we not only need to perform the
updates described in that refspec, but also update the remote-tracking
branch of the fetched remote heads according to the remote's configured
refspecs.

These "fetches" are not however to be written to FETCH_HEAD as they
would be duplicate data, and it's not what the user asked for.
2014-09-30 15:43:24 +02:00
Carlos Martín Nieto
9c206a2248 remote: use active refspec override in the tests
This lets us test this bit as well as getting closer to what they were
trying to do.
2014-09-30 15:42:32 +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
Jacques Germishuys
dc8adda4f1 git_remote_ls() should return an error if the transport is not available 2014-08-15 22:56:15 +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
Carlos Martín Nieto
66d585c6b3 MSVC doesn't like modern code 2014-01-27 04:58:23 +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
Ben Straub
1782038144 Rename tests-clar to tests 2013-11-14 14:05:52 -08:00