Commit Graph

177 Commits

Author SHA1 Message Date
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
Carlos Martín Nieto
d31402a3fc remote: put the _download() callback with the others
The text progress and update_tips callbacks are already part of the
struct, which was meant to unify the callback setup, but the download
one was left out.
2013-10-02 06:41:42 +02:00
Carlos Martín Nieto
64061d4a14 remote: fix git_remote_download() documentation
The description of what the function does hasn't been true for quite a
while. Change it to reflect the way it currently works.

While here, remove an even older comment about missing features that
have been implemented.
2013-07-23 10:51:14 +02:00
Etienne Samson
85e1eded6a Add git_remote_owner 2013-07-15 16:31:25 +02:00
Andreas Linde
e196716457 Fixed most documentation header bugs
Fixed a few header @param and @return typos with the help of -Wdocumentation in Xcode.

The following warnings have not been fixed:
common.h:213 - Not sure how the documentation format is for '...'
notes.h:102 - Correct @param name but empty text
notes.h:111 - Correct @param name but empty text
pack.h:140 - @return missing text
pack.h:148 - @return missing text
2013-06-24 15:33:41 +02:00
yorah
df50512aeb Proposal to handle default value (auto = 0) 2013-05-30 18:06:54 +02:00
Carlos Martín Nieto
1ffd0806f4 remote: add resfpec list accessors
Bring back a way of acessing the git_refspec* from a remote.

Closes #1514
2013-04-30 12:04:59 +02:00
Nikolai Vladimirov
a952b9867d remove git_remote_pushspec 2013-04-23 21:28:28 +03:00
Carlos Martín Nieto
bc6374eac4 remote: allow querying for refspecs
Introduce git_remote_{fetch,push}_refspecs() to get a list of refspecs
from the remote and rename the refspec-adding functions to a less
silly name.

Use this instead of the vector index hacks in the tests.
2013-04-20 19:45:40 +02:00
Carlos Martín Nieto
4330ab26b5 remote: handle multiple refspecs
A remote can have a multitude of refspecs. Up to now our git_remote's
have supported a single one for each fetch and push out of simplicity
to get something working.

Let the remotes and internal code know about multiple remotes and get
the tests passing with them.

Instead of setting a refspec, the external users can clear all and add
refspecs. This should be enough for most uses, though we're still
missing a querying function.
2013-04-20 17:54:13 +02:00
Carlos Martín Nieto
4a38143c93 remote: specify what values direction can mean in git_remote_connect()
This fixes #1487
2013-04-19 23:55:37 +02:00
nulltoken
2bca5b679b remote: Introduce git_remote_is_valid_name()
Fix libgit2/libgit2sharp#318
2013-02-11 23:19:41 +01:00
Ben Straub
3874f2d54f Kill vestigal dangling-remote code
Fixes #1232
2013-01-11 20:23:46 -08:00
Edward Thomson
359fc2d241 update copyrights 2013-01-08 17:31:27 -06:00
Ben Straub
0642c1431e Move url to last place in parameter list 2013-01-02 12:44:47 -08:00
nulltoken
f19304d265 remote: Prevent create() from blindly overwriting 2012-12-24 18:18:31 +01:00
nulltoken
ae35aa0708 remote: Improve documentation 2012-12-24 17:20:37 +01:00
nulltoken
b0aa14aa3c remote: Enhance in-memory remote test coverage 2012-12-24 16:54:27 +01:00
Ben Straub
79000951ec In-memory remotes don't have names 2012-12-21 08:05:59 -08:00
Ben Straub
87bc689fbf git_remote_create calls git_remote_save 2012-12-20 15:50:33 -08:00
Ben Straub
874dcb25eb Remote: deprecate dangling, prevent saving in-memory 2012-12-20 12:01:13 -08:00
Ben Straub
29f27599ea Rename remote creation APIs
git_remote_add -> git_remote_create
git_remote_new -> git_remote_create_inmemory
2012-12-20 10:52:57 -08:00
Ben Straub
7c353afd0e Define constant for default fetch spec 2012-12-13 08:47:29 -08:00
Ben Straub
b914e17d82 API to set a dangling remote's repository 2012-12-12 12:23:24 -08:00
Ben Straub
a71c27ccda Allow creation of dangling remotes 2012-12-12 12:15:25 -08:00
Ben Straub
59bccf33c4 Add a payload param to git_cred_acquire_cb
Fixes #1128.
2012-12-10 11:11:01 -08:00
Ben Straub
fac43c54a6 Allow compilation as C++ 2012-12-06 19:41:52 -08:00
Vicent Martí
e05ca13f1f Merge pull request #1115 from ben/struct-versions
Version info for public structs
2012-12-05 11:47:19 -08:00
nulltoken
032ba9e4ad remote: deploy EINVALIDSPEC usage 2012-12-01 08:34:23 +01:00
Ben Straub
9267ff586f Deploy GIT_REMOTE_CALLBACKS_INIT 2012-11-30 13:12:15 -08:00
Ben Straub
bde336ea51 Add version fields and init macros for public input structs. 2012-11-30 12:55:45 -08:00
Ben Straub
f4a62c306d Typedef enums. 2012-11-27 14:13:03 -08:00
Ben Straub
df705148ec API updates for remote.h
Includes typedef for git_direction, and renames for
GIT_DIR_[FETCH|PUSH] to GIT_DIRECTION_(\1).
2012-11-27 13:19:49 -08:00
Edward Thomson
b0f6e45d14 create FETCH_HEAD specially instead of as a ref file 2012-11-11 11:56:33 -06:00
Brian Schroeder
b0b8065880 Update documentation in remote.h 2012-11-08 21:28:15 -08:00
Philip Kelley
091361f569 Basic authentication for http and winhttp 2012-11-06 08:52:03 -05:00
Philip Kelley
41fb1ca0ec Reorganize transport architecture (squashed 3) 2012-11-01 09:02:33 -04:00
Russell Belfer
1b9346897b Merge pull request #925 from nulltoken/topic/moving-branch-updates-config
Updates config upon moving and deletion of branches
2012-10-25 10:55:03 -07:00
nulltoken
fcccf3045f remote: introduce git_remote_rename() 2012-10-25 17:42:36 +02:00
Ben Straub
1e3b8ed5cf Remove 'bytes' param from git_remote_download 2012-10-24 14:07:07 -07:00
Ben Straub
7d222e1312 Network progress: rename things
git_indexer_stats and friends -> git_transfer_progress*

Also made git_transfer_progress members more sanely
named.
2012-10-24 13:29:14 -07:00
Ben Straub
c4958e6818 Fix documentation comment 2012-10-24 12:38:05 -07:00
Ben Straub
c70ad945cd Update doc strings, warn about callback perf 2012-10-23 09:23:44 -07:00
Ben Straub
216863c48f Fetch/indexer: progress callbacks 2012-10-19 19:36:22 -07:00
Ben Straub
d57c47dc07 Add accessor for git_remote's stats field
Also converted the network example to use it.
2012-10-19 19:34:15 -07:00
Ben Straub
3028be0723 Add git_indexer_stats field to git_remote
Also removing all the *stats parameters from external
APIs that don't need them anymore.
2012-10-19 19:34:14 -07:00
Carlos Martín Nieto
f0d2ddbbf8 remote: support fetch cancelation
Introduce git_remote_stop() which sets a variable that is checked by
the fetch process in a few key places. If this is variable is set, the
fetch is aborted.
2012-10-18 04:31:03 +02:00
Paul Thompson
b46708aaf9 Separated git_strarray from common.h. Added doxy comments. 2012-10-11 23:04:08 +11:00
Carlos Martín Nieto
3230a44f4c remote: support downloading all tags
Also honor remote.$name.tagopt = --tags.
2012-09-30 12:05:28 +02:00
Carlos Martín Nieto
f70e466f68 remote: add accessors for the autotag setting 2012-09-30 12:04:49 +02:00
Carlos Martín Nieto
24f2f94e7d fetch: use the include-tag capability
This tells the remote to send us any tags that point to objects that
we are downloading.
2012-09-30 11:56:38 +02:00
Carlos Martín Nieto
e03e71da56 network: add sideband support
This lets us notify the user of what the remote end is doing while we
wait for it to start sending us the packfile.
2012-08-24 20:29:39 +02:00
Vicent Marti
51e1d80846 Merge remote-tracking branch 'arrbee/tree-walk-fixes' into development
Conflicts:
	src/notes.c
	src/transports/git.c
	src/transports/http.c
	src/transports/local.c
	tests-clar/odb/foreach.c
2012-08-06 12:41:08 +02:00
Russell Belfer
5dca201072 Update iterators for consistency across library
This updates all the `foreach()` type functions across the library
that take callbacks from the user to have a consistent behavior.
The rules are:

* A callback terminates the loop by returning any non-zero value
* Once the callback returns non-zero, it will not be called again
  (i.e. the loop stops all iteration regardless of state)
* If the callback returns non-zero, the parent fn returns GIT_EUSER
* Although the parent returns GIT_EUSER, no error will be set in
  the library and `giterr_last()` will return NULL if called.

This commit makes those changes across the library and adds tests
for most of the iteration APIs to make sure that they follow the
above rules.
2012-08-03 17:08:01 -07:00
Vicent Martí
60d5cc5747 Merge pull request #834 from carlosmn/network-callbacks
Add a struct for network callbacks
2012-07-27 09:52:44 -07:00
Sascha Cunz
765015902a Remotes: Setter for url+pushurl; Getter for pushurl 2012-07-26 23:08:22 +02:00
Carlos Martín Nieto
b3aaa7a7c8 Add a struct for network callbacks
Currently only update_tips is used, but it prepares the way for
progress output during download.
2012-07-21 18:44:01 +02:00
Vicent Martí
966fbdcb8e Merge pull request #697 from carlosmn/ssl
Add HTTPS support
2012-06-05 13:53:33 -07:00
Carlos Martín Nieto
250b95b24b ssl: allow skipping the server certificate check
Sometimes it's useful not to perform the check. Allow it to be
configurable.
2012-05-26 21:17:08 +02:00
Bruce Mitchener
d73c94b21c Fix spelling errors. 2012-05-19 20:26:52 +07:00
Vicent Martí
e172cf082e errors: Rename the generic return codes 2012-05-18 01:26:26 +02:00
Carlos Martín Nieto
baaa8a447e remotes: change git_remote_new's signature
Add a fetch refspec arguemnt and make the arguments (name, url,
refspec), as that order makes more sense.
2012-05-08 21:36:40 +02:00
Carlos Martín Nieto
a209a025c6 remote: add git_remote_add()
Helper function to create a remote with the default settings
2012-05-08 21:36:40 +02:00
Vicent Martí
40879facad Merge branch 'new-error-handling' into development
Conflicts:
	.travis.yml
	include/git2/diff.h
	src/config_file.c
	src/diff.c
	src/diff_output.c
	src/mwindow.c
	src/path.c
	tests-clar/clar_helpers.c
	tests-clar/object/tree/frompath.c
	tests/t00-core.c
	tests/t03-objwrite.c
	tests/t08-tag.c
	tests/t10-refs.c
	tests/t12-repo.c
	tests/t18-status.c
	tests/test_helpers.c
	tests/test_main.c
2012-05-02 15:59:02 -07:00
Michael Schubert
8af503bc85 remote: add more doc on git_remote_free 2012-04-28 20:49:05 +02:00
Carlos Martín Nieto
f184836bd2 remote: run a callback when updating the branch tips
This allows the caller to update an internal structure or update the
user output with the tips that were updated.

While in the area, only try to update the ref if the value is
different from its old one.
2012-04-25 13:25:45 +02:00
Carlos Martín Nieto
dee5515a23 transports: buffer the git requests before sending them
Trying to send every single line immediately won't give us any speed
improvement and duplicates the code we need for other transports. Make
the git transport use the same buffer functions as HTTP.
2012-04-25 12:44:27 +02:00
Carlos Martín Nieto
7a520f5d8a fetch: use the streaming indexer when downloading a pack
This changes the git_remote_download() API, but the existing one is
silly, so you don't get to complain.

The new API allows to know how much data has been downloaded, how many
objects we expect in total and how many we've processed.
2012-04-25 12:39:11 +02:00