summaryrefslogtreecommitdiff
path: root/src/clone.c
Commit message (Collapse)AuthorAgeFilesLines
* repository: remove log message override for switching the active branchCarlos Martín Nieto2015-03-031-3/+2
| | | | | | We want to use the "checkout: moving from ..." message in order to let git know when a change of branch has happened. Make the convenience functions for this goal write this message.
* branch: don't accept a reflog message overrideCarlos Martín Nieto2015-03-031-1/+5
| | | | | | | This namespace is about behaving like git's branch command, so let's do exactly that instead of taking a reflog message. This override is still available via the reference namespace.
* Remove the signature from ref-modifying functionsCarlos Martín Nieto2015-03-031-24/+19
| | | | | | | | | | 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.
* remote: allow overriding the refspecs for download and fetchCarlos Martín Nieto2014-09-301-2/+2
| | | | | | | 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.
* clone: handle overly restrictive refspecscmn/remote-default-restrictCarlos Martín Nieto2014-09-021-23/+22
| | | | | | | | | | | 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`.
* clone: correct handling of an unborn HEADCarlos Martín Nieto2014-09-021-19/+2
| | | | | 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.
* clone: support remotes with references but no branchesCarlos Martín Nieto2014-08-291-2/+19
| | | | | | | A repository can have any number of references which we're not interested in such as notes or tags. For the default branch calculation we only care about branches. Make the decision about the number of branches rather than the number of refs in general.
* Merge pull request #2471 from jacquesg/compatibility-cleanupVicent Marti2014-08-071-0/+3
|\ | | | | Compatibility/Portability cleanup
| * Silence unused variables warningsJacques Germishuys2014-08-051-0/+3
| |
* | clone: should_clone? Of course we should clone. That's not the questionVicent Marti2014-07-161-4/+4
| |
* | Handle local file:/// paths on WindowsEdward Thomson2014-07-111-18/+24
|/ | | | | Windows can't handle a path like `/c:/foo`; when turning file:/// URIs into local paths, we must strip the leading slash.
* clone: remote git_clone_into{,_local} from the public APIcmn/clone-custom-repoCarlos Martín Nieto2014-07-021-4/+6
| | | | | | As git_clone now has callbacks to configure the details of the repository and remote, remove the lower-level functions from the public API, as they lack some of the logic from git_clone proper.
* clone: add a callback for repository creationCarlos Martín Nieto2014-07-021-1/+14
| | | | | | Analogously to the remote creation callback, provide a way for the user of git_clone() to create the repository with whichever options they desire via callback.
* Improvements to git_transport extensibilityPhilip Kelley2014-06-261-8/+23
| | | | | 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
* 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.