summaryrefslogtreecommitdiff
path: root/src/remote.c
Commit message (Collapse)AuthorAgeFilesLines
* remote: tighten up reference renamingcmn/remote-rename-fixesCarlos Martín Nieto2014-06-061-7/+9
| | | | | | | | Tighten up which references we consider for renaming so we don't try to rename unrelated ones and end up with unexplained references. If there is a reference on the target namespace, git overwrites it, so let's do the same.
* Merge pull request #2389 from ↵Vicent Marti2014-06-031-0/+1
|\ | | | | | | | | arthurschreiber/arthur/set-error-when-no-remote-found Remote: Set an error when a remote cannot be found.
| * Remote: Set an error when a remote cannot be found.Arthur Schreiber2014-05-301-0/+1
| | | | | | | | | | | | | | 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.
* | remote: build up the list of refs to removecmn/remote-deleteCarlos Martín Nieto2014-06-011-8/+34
|/ | | | | | When removing the remote-tracking branches, build up the list and remove in two steps, working around an issue with the iterator. Removing while we're iterating over the refs can cause us to miss references.
* remote: add api to guess the remote's default branchCarlos Martín Nieto2014-05-211-0/+47
| | | | | If the remote supports the symref protocol extension, then we return that, otherwise we guess with git's rules.
* Merge pull request #2313 from libgit2/cmn/remote-deleteVicent Marti2014-05-161-3/+145
|\ | | | | Remote deletion
| * remote: remove remote-tracking branches on deleteCarlos Martín Nieto2014-05-161-4/+54
| | | | | | | | | | When we delete a remote, we also need to go through its fetch refspecs and remove the references they create locally.
| * remote: move branch upstream deletion to use an iteratorCarlos Martín Nieto2014-04-301-57/+38
| | | | | | | | This should make it more readable and allocate a bunch fewer strings.
| * remote: Introduce git_remote_delete()nulltoken2014-04-301-3/+114
| |
* | Merge pull request #2188 from libgit2/cmn/config-snapshotRussell Belfer2014-05-121-2/+3
|\ \ | | | | | | Configuration snapshotting
| * | repository: introduce a convenience config snapshot methodcmn/config-snapshotCarlos Martín Nieto2014-05-071-5/+2
| | | | | | | | | | | | | | | | | | Accessing the repository's config and immediately taking a snapshot of it is a common operation, so let's provide a convenience function for it.
| * | Use config snapshottingCarlos Martín Nieto2014-04-181-2/+6
| | | | | | | | | | | | | | | This way we can assume we have a consistent view of the config situation when we're looking up remote, branch, pack-objects, etc.
* | | Fix remaining init_options inconsistenciesRussell Belfer2014-05-021-9/+4
| | | | | | | | | | | | | | | There were a couple of "init_opts()" functions a few more cases of structure initialization that I somehow missed.
* | | Check for NULL before passing it to vsnprintfJacques Germishuys2014-04-301-1/+1
| |/ |/|
* | Merge pull request #2284 from jacquesg/push-progress-callbackVicent Marti2014-04-251-2/+2
|\ \ | | | | | | Fire progress and update tips callbacks also for pushes.
| * | Rename progress callback to sideband_progressJacques Germishuys2014-04-211-2/+2
| |/
* | remote: provide read access to the callback structureCarlos Martín Nieto2014-04-221-0/+7
|/ | | | | This should make it easier for bindings to dynamically override their own callbacks.
* Merge pull request #2215 from libgit2/rb/submodule-cache-fixesVicent Marti2014-04-041-51/+35
|\ | | | | Improve submodule cache management
| * Fix git_submodule_sync and add new config helperRussell Belfer2014-04-011-51/+35
| | | | | | | | | | | | | | | | | | | | | | | | This fixes `git_submodule_sync` to correctly update the remote URL of the default branch of the submodule along with the URL in the parent repository config (i.e. match core Git's behavior). Also move some useful helper logic from the submodule code into a shared config API `git_config__update_entry` that can either set or delete an entry with constraints like not overwriting or not creating a new entry. I used that helper to update a couple other places in the code.
* | remote: mark branch for-merge even if we're unbornCarlos Martín Nieto2014-04-021-7/+20
|/ | | | | | | | | | | When the current branch is unborn, git will still mark the current branch's upstream for-merge if there is an upstream configuration. The only non-constrived case is cloning from an empty repository which then gains history. origin's master should be marked for-merge. In order to do this, we cannot use the high-level wrappers that expect a reference, as we may not have one. Move over to the internal ones that expect a reference name, which we do have.
* remote: rename inmemory to anonymous and swap url and fetch orderCarlos Martín Nieto2014-04-011-4/+4
| | | | | | | | | | 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.
* Added function-based initializers for every options struct.Matthew Bowen2014-03-051-0/+12
| | | | The basic structure of each function is courtesy of arrbee.
* Fixed missing error check on call to git_remote_download in ↵Brian Lambert2014-03-051-2/+5
| | | | git_remote_fetch. Moved error check to statement following git_remote_disconnect so that the disconnect happens regardless of the result of the download call.
* Correct default reflog message for git_remote_fetchBen Straub2014-02-061-1/+12
|
* Add reflog parameters to remote apisBen Straub2014-02-041-7/+19
| | | Also added a test for git_remote_fetch.
* Ensure renaming a reference updates the reflogBen Straub2014-01-301-10/+18
|
* refspec: move to git_buf for outputting stringsCarlos Martín Nieto2014-01-271-2/+2
|
* Make sure git_remote_dup copies a remote's refspecs correctly.Arthur Schreiber2014-01-261-8/+26
|
* Add some missing const declarations.Arthur Schreiber2014-01-261-7/+7
|
* refs: remove the _with_log differentiationCarlos Martín Nieto2014-01-151-1/+1
| | | | | | Any well-behaved program should write a descriptive message to the reflog whenever it updates a reference. Let's make this more prominent by removing the version without the reflog parameters.
* We don't need memset here.Arthur Schreiber2014-01-141-2/+0
|
* Don't duplicate state that's only used when fetching.Arthur Schreiber2014-01-141-1/+0
|
* Add `git_remote_dup`.Arthur Schreiber2014-01-141-0/+41
|
* Cleanups, renames, and leak fixesRussell Belfer2013-12-121-2/+2
| | | | | | | | | This renames git_vector_free_all to the better git_vector_free_deep and also contains a couple of memory leak fixes based on valgrind checks. The fixes are specifically: failure to free global dir path variables when not compiled with threading on and failure to free filters from the filter registry that had not be initialized fully.
* One more rename/cleanup for callback err functionsRussell Belfer2013-12-111-1/+1
|
* Some callback error check style cleanupsRussell Belfer2013-12-111-2/+4
| | | | I find this easier to read...
* Remove converting user error to GIT_EUSERRussell Belfer2013-12-111-61/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the behavior of callbacks so that the callback error code is not converted into GIT_EUSER and instead we propagate the return value through to the caller. Instead of using the giterr_capture and giterr_restore functions, we now rely on all functions to pass back the return value from a callback. To avoid having a return value with no error message, the user can call the public giterr_set_str or some such function to set an error message. There is a new helper 'giterr_set_callback' that functions can invoke after making a callback which ensures that some error message was set in case the callback did not set one. In places where the sign of the callback return value is meaningful (e.g. positive to skip, negative to abort), only the negative values are returned back to the caller, obviously, since the other values allow for continuing the loop. The hardest parts of this were in the checkout code where positive return values were overloaded as meaningful values for checkout. I fixed this by adding an output parameter to many of the internal checkout functions and removing the overload. This added some code, but it is probably a better implementation. There is some funkiness in the network code where user provided callbacks could be returning a positive or a negative value and we want to rely on that to cancel the loop. There are still a couple places where an user error might get turned into GIT_EUSER there, I think, though none exercised by the tests.
* Add git_vector_free_allRussell Belfer2013-12-111-12/+2
| | | | | | There are a lot of places that we call git__free on each item in a vector and then call git_vector_free on the vector itself. This just wraps that up into one convenient helper function.
* Further EUSER and error propagation fixesRussell Belfer2013-12-111-24/+23
| | | | | | | | | | | | | This continues auditing all the places where GIT_EUSER is being returned and making sure to clear any existing error using the new giterr_user_cancel helper. As a result, places that relied on intercepting GIT_EUSER but having the old error preserved also needed to be cleaned up to correctly stash and then retrieve the actual error. Additionally, as I encountered places where error codes were not being propagated correctly, I tried to fix them up. A number of those fixes are included in the this commit as well.
* Improve GIT_EUSER handlingRussell Belfer2013-12-111-58/+66
| | | | | | | | | | | This adds giterr_user_cancel to return GIT_EUSER and clear any error message that is sitting around. As a result of using that in places, we need to be more thorough with capturing errors that happen inside a callback when used internally. To help with that, this also adds giterr_capture and giterr_restore so that when we internally use a foreach-type function that clears errors and converts them to GIT_EUSER, it is easier to restore not just the return value, but the actual error message text.
* Add config read fns with controlled error behaviorRussell Belfer2013-12-111-37/+26
| | | | | | | | | | | | | | | | | | | | | | | | This adds `git_config__lookup_entry` which will look up a key in a config and return either the entry or NULL if the key was not present. Optionally, it can either suppress all errors or can return them (although not finding the key is not an error for this function). Unlike other accessors, this does not normalize the config key string, so it must only be used when the key is known to be in normalized form (i.e. all lower-case before the first dot and after the last dot, with no invalid characters). This also adds three high-level helper functions to look up config values with no errors and a fallback value. The three functions are for string, bool, and int values, and will resort to the fallback value for any error that arises. They are: * `git_config__get_string_force` * `git_config__get_bool_force` * `git_config__get_int_force` None of them normalize the config `key` either, so they can only be used for internal cases where the key is known to be in normal format.
* Merge pull request #1967 from victorgp/cleaning-code-minor-changeVicent Martí2013-11-191-4/+0
|\ | | | | Cleaning code, removing unused variables
| * cleaning code, removing unused variablesVictor Garcia2013-11-191-4/+0
| |
* | Fix warningsRussell Belfer2013-11-181-3/+3
| |
* | Propagate auth error codes as GIT_EUSER in winhttpEdward Thomson2013-11-181-27/+44
|/
* Merge pull request #1951 from victorgp/create-remote-plus-fetchVicent Martí2013-11-141-0/+30
|\ | | | | Allowing create remotes with custom fetch spec
| * splitting funcionality in two methods to avoid ambiguity with NULLVictor Garcia2013-11-081-6/+33
| |
| * allowing create remote with custom fetch specVictor Garcia2013-11-071-4/+7
| |
* | remote: let's at least pretend to have some memory safetyCarlos Martín Nieto2013-11-111-3/+27
| | | | | | | | | | | | Copy the pointers into temporary vectors instead of assigning them tot he same array so we don't mess up with someone else's memory by accident (e.g. by sorting).
* | remote: fix a couple of leaksCarlos Martín Nieto2013-11-111-6/+0
| |