summaryrefslogtreecommitdiff
path: root/src/clone.c
Commit message (Collapse)AuthorAgeFilesLines
* clone: re-use the local transport's path resolutioncmn/path-to-pathCarlos Martín Nieto2014-06-031-15/+3
| | | | | | Whe already worked out the kinks with the function used in the local transport. Expose it and make use of it in the local clone method instead of trying to work it out again.
* clone: allow for linking in local cloneCarlos Martín Nieto2014-05-281-5/+31
| | | | | | | | If requested, git_clone_local_into() will try to link the object files instead of copying them. This only works on non-Windows (since it doesn't have this) when both are on the same filesystem (which are unix semantics).
* clone: add flag not to linkCarlos Martín Nieto2014-05-281-1/+1
|
* clone: add flags to override whether to perform a local cloneCarlos Martín Nieto2014-05-281-1/+24
|
* clone: store the realpath when given a relative oneCarlos Martín Nieto2014-05-281-1/+10
| | | | | | | A call like git_clone("./foo", "./foo1") writes origin's url as './foo', which makes it unusable, as they're relative to different things. Go with git's behaviour and store the realpath as the url.
* clone: perform a "local clone" when given a local pathCarlos Martín Nieto2014-05-281-11/+103
| | | | | | | | When git is given such a path, it will perform a "local clone", bypassing the git-aware protocol and simply copying over all objects that exist in the source. Copy this behaviour when given a local path.
* Plug leaks and fix a C99-ismCarlos Martín Nieto2014-05-221-1/+2
| | | | | | | We have too many places where we repeat free code, so when adding the new free to the generic code, it didn't take for the local transport. While there, fix a C99-ism that sneaked through.
* clone: get rid of head_infocmn/remote-symrefCarlos Martín Nieto2014-05-211-23/+12
| | | | | Since we no longer need to push data to callbacks, there's no need for this truct.
* clone: make use of the remote's default branch guessingCarlos Martín Nieto2014-05-211-67/+17
| | | | | Let's use the remote's default branch guessing instead of reinventing one ourselves with callbacks.
* Minor fix for cmn/clone-into-mirror.Albert Meltzer2014-05-201-4/+2
| | | | | A recently added check might skip initialization of old_fetchhead and go directly to cleanup. So, destruct in the opposite order of construction.
* clone: don't error out if the branch already existscmn/clone-into-mirrorCarlos Martín Nieto2014-05-191-0/+4
| | | | | | | | | We set up the current branch after we fetch from the remote. This means that the user's refspec may have already created this reference. It is therefore not an error if we cannot create the branch because it already exists. This allows for the user to replicate git-clone's --mirror option.
* clone: duplicate the remoteCarlos Martín Nieto2014-05-191-15/+12
| | | | | | Instead of changing the user-provided remote, duplicate it so we can add the extra refspec without having to worry about unsetting it before returning.
* Make init_options fns use unsigned ints and macroRussell Belfer2014-05-021-9/+4
| | | | | Use an unsigned int for the version and add a helper macro so the code is simplified (and so the error message is a common string).
* clone: don't overwrite original error messageEdward Thomson2014-03-251-0/+5
|
* git_checkout_opts -> git_checkout_optionsBen Straub2014-03-061-2/+2
|
* Added function-based initializers for every options struct.Matthew Bowen2014-03-051-0/+12
| | | | The basic structure of each function is courtesy of arrbee.
* Add reflog parameters to remote apisBen Straub2014-02-041-1/+1
| | | Also added a test for git_remote_fetch.
* Enhance testing of signature parametersBen Straub2014-01-301-1/+1
|
* Augment clone API with reflog parametersBen Straub2014-01-301-13/+23
|
* Add reflog params to git_branch_createBen Straub2014-01-301-1/+1
|
* Add reflog params to set-head callsBen Straub2014-01-301-10/+21
|
* refspec: move to git_buf for outputting stringsCarlos Martín Nieto2014-01-271-2/+2
|
* Update clone doc and tests for callback return valRussell Belfer2013-12-111-1/+2
| | | | | | | Clone callbacks can return non-zero values to cancel the clone. This adds some tests to verify that this actually works and updates the documentation to be clearer that this can happen and that the return value will be propagated back by the clone function.
* Remove converting user error to GIT_EUSERRussell Belfer2013-12-111-15/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Further EUSER and error propagation fixesRussell Belfer2013-12-111-65/+55
| | | | | | | | | | | | | 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.
* remote: make _ls return the list directlyCarlos Martín Nieto2013-11-111-17/+8
| | | | | | | | | | | 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.
* remote: don't allow such direct access to the refspecsCarlos Martín Nieto2013-11-101-4/+12
| | | | | | 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.
* Initial iconv hookup for precomposed unicodeRussell Belfer2013-10-031-23/+19
| | | | | | | | | | | | | | | | | | | | This hooks up git_path_direach and git_path_dirload so that they will take a flag indicating if directory entry names should be tested and converted from decomposed unicode to precomposed form. This code will only come into play on the Apple platform and even then, only when certain types of filesystems are used. This involved adding a flag to these functions which involved changing a lot of places in the code. This was an opportunity to do a bit of code cleanup here and there, for example, getting rid of the git_futils_cleanupdir_r function in favor of a simple flag to git_futils_rmdir_r to not remove the top level entry. That ended up adding depth tracking during rmdir_r which led to a safety check for infinite directory recursion. Yay. This hasn't actually been tested on the Mac filesystems where the issue occurs. I still need to get test environment for that.
* clone: put the callbacks struct directly in the clone optionsCarlos Martín Nieto2013-10-021-2/+1
| | | | There's no need for this to be a pointer to somewhere else.
* clone: bring back NULL as defaultsCarlos Martín Nieto2013-10-021-5/+9
| | | | This wasremoved as part of the large culling a few commits ago.
* clone: re-allow using a custom remote nameCarlos Martín Nieto2013-10-021-1/+3
| | | | | This is a small thing that by itself doesn't quite justify making the user use clone_into.
* clone: const-ify checkout optionsCarlos Martín Nieto2013-10-021-2/+2
| | | | | The removal of many options which lead to the direct usage of the user's checkout options means we should make sure they remain const.
* clone: re-add a way to ignore certificate errorsCarlos Martín Nieto2013-10-021-0/+3
| | | | | This used to be done via transport flags, which was removed in a previous commit.
* clone: remove more options from basic cloneCarlos Martín Nieto2013-10-021-43/+5
| | | | | | The basic clone function is there to make it easy to create a "normal" clone. Remove a bunch of options that are about changing the remote's configuration.
* clone: implement git_clone on top of git_clone_intoCarlos Martín Nieto2013-10-021-58/+19
| | | | Unify the code bases.
* clone: remove the autotag optionCarlos Martín Nieto2013-10-021-8/+5
| | | | | Downloading all tags is part of what makes it a clone instead of simply a fetch.
* remote: add a convenience 'fetch' function.Carlos Martín Nieto2013-10-021-20/+2
|
* clone: implement git_clone_intoCarlos Martín Nieto2013-10-021-15/+63
| | | | | This allows you to set up the repository and remote as you which to have them before performing the clone operation.
* remote: move the credentials callback to the structCarlos Martín Nieto2013-10-021-2/+0
| | | | | 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.
* remote: put the _download() callback with the othersCarlos Martín Nieto2013-10-021-2/+1
| | | | | | 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.
* No such thing as an orphan branchCarlos Martín Nieto2013-09-171-1/+1
| | | | | | | | | | | Unfortunately git-core uses the term "unborn branch" and "orphan branch" interchangeably. However, "orphan" is only really there for the checkout command, which has the `--orphan` option so it doesn't actually create the branch. Branches never have parents, so the distinction of a branch with no parents is odd to begin with. Crucially, the error messages deal with unborn branches, so let's use that.
* clone: Anal as fuckVicent Marti2013-09-161-2/+1
|
* git_clone supports optional init_optionsLinquize2013-09-161-3/+11
|
* Make refspec_transform paranoid about argumentsRussell Belfer2013-07-011-2/+2
|
* Reorganize diff and add basic diff driverRussell Belfer2013-06-101-0/+1
| | | | | | | | | | | | | | | | | | This is a significant reorganization of the diff code to break it into a set of more clearly distinct files and to document the new organization. Hopefully this will make the diff code easier to understand and to extend. This adds a new `git_diff_driver` object that looks of diff driver information from the attributes and the config so that things like function content in diff headers can be provided. The full driver spec is not implemented in the commit - this is focused on the reorganization of the code and putting the driver hooks in place. This also removes a few #includes from src/repository.h that were overbroad, but as a result required extra #includes in a variety of places since including src/repository.h no longer results in pulling in the whole world.
* Merge pull request #1624 from libgit2/vmg/full-ref-iteratorVicent Martí2013-06-031-1/+1
|\ | | | | Breaking RefDB changes
| * What are the chances, reallyVicent Marti2013-05-291-1/+1
| |
* | Merge pull request #1621 from NHDaly/clone_transport_flagsVicent Martí2013-05-311-0/+4
|\ \ | | | | | | Added support for setting transport flags (No check SSL cert) to git_clo...
| * | Added support for setting transport flags (No check SSL cert) to git_clone call.Nathan Daly2013-05-311-0/+4
| |/
* | Proposal to handle default value (auto = 0)yorah2013-05-301-1/+0
|/