src/clone.c


Log

Author Commit Date CI Message
Carlos Martín Nieto bf522e08 2014-01-26T16:59:36 refspec: move to git_buf for outputting strings
Russell Belfer 8f1066a0 2013-12-10T16:02:24 Update clone doc and tests for callback return val 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.
Russell Belfer 25e0b157 2013-12-06T15:07:57 Remove converting user error to GIT_EUSER 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.
Russell Belfer dab89f9b 2013-12-04T21:22:57 Further EUSER and error propagation fixes 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.
Carlos Martín Nieto 359dce72 2013-11-02T00:05:32 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.
Carlos Martín Nieto 266af6d8 2013-10-30T13:44:22 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.
Victor Garcia 40b99d05 2013-11-08T12:14:31 splitting funcionality in two methods to avoid ambiguity with NULL
Victor Garcia 0fe522d1 2013-11-07T14:16:20 allowing create remote with custom fetch spec
Russell Belfer 219d3457 2013-10-01T16:12:15 Initial iconv hookup for precomposed unicode 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.
Carlos Martín Nieto 0e0cf787 2013-10-02T14:04:44 clone: put the callbacks struct directly in the clone options There's no need for this to be a pointer to somewhere else.
Carlos Martín Nieto fdc7e5e3 2013-09-20T23:14:12 clone: bring back NULL as defaults This wasremoved as part of the large culling a few commits ago.
Carlos Martín Nieto c833893c 2013-09-20T22:57:01 clone: re-allow using a custom remote name This is a small thing that by itself doesn't quite justify making the user use clone_into.
Carlos Martín Nieto eec1c1fe 2013-09-20T22:49:20 clone: const-ify checkout options 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.
Carlos Martín Nieto b9bf5d70 2013-09-20T22:46:32 clone: re-add a way to ignore certificate errors This used to be done via transport flags, which was removed in a previous commit.
Carlos Martín Nieto 6ac15eff 2013-09-20T22:34:05 clone: remove more options from basic clone 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.
Carlos Martín Nieto e3a92f0d 2013-09-17T05:31:34 clone: implement git_clone on top of git_clone_into Unify the code bases.
Carlos Martín Nieto c8dbec48 2013-09-16T18:42:53 clone: remove the autotag option Downloading all tags is part of what makes it a clone instead of simply a fetch.
Carlos Martín Nieto fe3a40a4 2013-09-16T16:54:37 remote: add a convenience 'fetch' function.
Carlos Martín Nieto d19870d9 2013-09-16T05:10:55 clone: implement git_clone_into This allows you to set up the repository and remote as you which to have them before performing the clone operation.
Carlos Martín Nieto e3c131c5 2013-09-16T05:02:25 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.
Carlos Martín Nieto d31402a3 2013-09-16T04:20:05 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.
Carlos Martín Nieto 605da51a 2013-09-17T09:50:30 No such thing as an orphan branch 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.
Vicent Marti c62b5ca5 2013-09-16T22:23:05 clone: Anal as fuck
Linquize f2df503b 2013-09-14T18:22:16 git_clone supports optional init_options
Russell Belfer 55ededfd 2013-07-01T10:21:14 Make refspec_transform paranoid about arguments
Russell Belfer 114f5a6c 2013-06-10T10:10:39 Reorganize diff and add basic diff driver 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.
Vicent Martí 947fad4f 2013-06-03T09:28:58 Merge pull request #1624 from libgit2/vmg/full-ref-iterator Breaking RefDB changes
Vicent Martí 8d863aa2 2013-05-31T06:01:59 Merge pull request #1621 from NHDaly/clone_transport_flags Added support for setting transport flags (No check SSL cert) to git_clo...
Nathan Daly 88392914 2013-05-30T01:12:27 Added support for setting transport flags (No check SSL cert) to git_clone call.
yorah df50512a 2013-05-30T18:06:54 Proposal to handle default value (auto = 0)
Vicent Marti ec24e542 2013-05-29T22:47:37 What are the chances, really
nulltoken 1fed6b07 2013-05-13T21:57:37 Fix trailing whitespaces
Edward Thomson b6cc559a 2013-05-11T02:42:49 Merge pull request #1385 from carlosmn/refs-iter Introduce a refs iterator
Carlos Martín Nieto 2b562c3a 2013-05-04T16:32:58 refs: remove the OID/SYMBOLIC filtering Nobody should ever be using anything other than ALL at this level, so remove the option altogether. As part of this, git_reference_foreach_glob is now implemented in the frontend using an iterator. Backends will later regain the ability of doing the glob filtering in the backend.
Michael Schubert ae59321f 2013-05-10T14:31:58 clone: fix -Wmaybe-uninitialized warning
Vicent Martí 03c28d92 2013-05-06T06:45:53 Merge pull request #1526 from arrbee/cleanup-error-return-without-msg Make sure error messages are set for most error returns
Jameson Miller 6f748f38 2013-05-04T12:14:40 Do not write tagopt configuration option on clone by default
Russell Belfer 46779411 2013-05-01T05:32:10 fix typo
Russell Belfer f6f48f90 2013-05-01T04:57:05 Simplify error reporting
Russell Belfer b7f167da 2013-04-29T13:52:12 Make git_oid_cmp public and add git_oid__cmp
Ben Straub bd0a07f4 2013-04-23T12:28:59 Clone: replace fetch spec with custom value
Carlos Martín Nieto bc6374ea 2013-04-20T18:49:11 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.
Carlos Martín Nieto 4330ab26 2013-04-20T04:43:28 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.
Jameson Miller 926acbcf 2013-03-01T11:07:53 Clone should not delete directories it did not create
Russell Belfer 9c258af0 2013-02-12T10:13:56 Merge pull request #1316 from ben/clone-cancel Allow network operations to cancel
Ben Straub f393d4e8 2013-02-06T13:07:56 Clone: fetch all tags
Ben Straub fe95ac1b 2013-02-05T10:59:58 Allow progress callback to cancel fetch This works by having the indexer watch the return code of the callback, so will only take effect on object boundaries.
Frank Li 28c3beaa 2013-01-27T15:02:06 Fix fail clone local repo which head detatched Set head detach if can't found branch after download Signed-off-by: Frank Li <lznuaa@gmail.com>
Sascha Cunz 1265b51f 2013-01-11T03:07:50 Add missing git_buf_free
Sascha Cunz 88aef766 2013-01-11T02:45:55 Implement analog for 'git checkout --branch xxx ...'
Sascha Cunz 132c2db6 2013-01-11T02:18:27 Fix possible free'ing of unitialized pointer in error case
Edward Thomson 359fc2d2 2013-01-08T17:07:25 update copyrights
Vicent Martí 5df7ad3e 2013-01-06T07:56:45 Merge pull request #1196 from scunz/allow_clone_without_master_branch Allow to clone repositories that don't have a `master` branch
nulltoken d1aee477 2013-01-06T15:09:27 clone: Fix a memory leak
Sascha Cunz 2ba6f3c7 2013-01-06T14:30:52 Allow to clone repositories that don't have a `master` branch Before this, we error out from `reference_matches_remote_head` if the reference we're searching for does not exist. Since we explicitly check if master is existing in `update_head_to_remote` and error out if it doesn't, a repository without master branch could not be cloned. In fact this was later clobbered by what is fixed in #1194. However, this patch introduces a `found` member in `head_info` and sets it accordingly. That also saves us from checking the string length of `branchname` a few times.
Russell Belfer 2850252a 2013-01-03T09:11:52 Oh yeah, bugs from my rebase
Ben Straub 730df6d0 2013-01-02T13:43:54 Include checkout options inline
Ben Straub 29f27599 2012-12-20T10:51:09 Rename remote creation APIs git_remote_add -> git_remote_create git_remote_new -> git_remote_create_inmemory
Ben Straub 00998a12 2012-12-19T16:51:58 Initialize variable
Ben Straub 621b50e4 2012-12-19T16:51:37 Clone: trust but verify
Ben Straub b412d563 2012-12-18T19:46:05 Add more clone options. Push test suite segfaults.
Ben Straub b9e7e2b4 2012-12-14T13:46:45 Move non-options back out of options struct
Ben Straub 18b2d560 2012-12-14T13:03:59 Deploy git_clone_options; remove git_clone_bare
Ben Straub 24393ea6 2012-12-13T09:14:56 Stop premature remote freeing when cloning
Ben Straub 44f36f6e 2012-12-12T19:48:44 Convert clone to use dangling remotes
Ben Straub df705148 2012-11-27T13:15:43 API updates for remote.h Includes typedef for git_direction, and renames for GIT_DIR_[FETCH|PUSH] to GIT_DIRECTION_(\1).
Vicent Marti cfbe4be3 2012-11-17T19:54:47 More external API cleanup Conflicts: src/branch.c tests-clar/refs/branches/create.c
Ben Straub 2508cc66 2012-11-18T21:38:08 Rename ref and reflog apis for consistency
Vicent Martí aa1c3b58 2012-11-13T14:13:47 Merge pull request #1016 from arrbee/fix-checkout-dir-removal Update checkout with new strategies & behavior
Edward Thomson b0f6e45d 2012-11-01T15:47:18 create FETCH_HEAD specially instead of as a ref file
Russell Belfer 331e7de9 2012-10-24T17:32:50 Extensions to rmdir and mkdir utilities * Rework GIT_DIRREMOVAL values to GIT_RMDIR flags, allowing combinations of flags * Add GIT_RMDIR_EMPTY_PARENTS flag to remove parent dirs that are left empty after removal * Add GIT_MKDIR_VERIFY_DIR to give an error if item is a file, not a dir (previously an EEXISTS error was ignored, even for files) and enable this flag for git_futils_mkpath2file call * Improve accuracy of error messages from git_futils_mkdir
Philip Kelley 41fb1ca0 2012-10-29T13:41:14 Reorganize transport architecture (squashed 3)
Ben Straub 1e3b8ed5 2012-10-24T14:07:07 Remove 'bytes' param from git_remote_download
Ben Straub 7d222e13 2012-10-24T13:29:14 Network progress: rename things git_indexer_stats and friends -> git_transfer_progress* Also made git_transfer_progress members more sanely named.
Ben Straub aa1e8674 2012-10-18T12:57:47 Clone: in-line callbacks for progress Also implemented in the git2 example.
Ben Straub 9c3a98f1 2012-10-18T09:57:19 Fix clone.c's indentation
Ben Straub 216863c4 2012-10-17T14:02:24 Fetch/indexer: progress callbacks
Ben Straub 183d8bdd 2012-10-16T20:33:48 Remove checkout_stats from git_clone
Ben Straub 80642656 2012-10-16T20:23:10 Convert checkout_* to use progress callback
Ben Straub 2c8bbb27 2012-10-16T20:16:21 Convert checkout_index to use progress callback
Ben Straub 3028be07 2012-10-16T13:10:27 Add git_indexer_stats field to git_remote Also removing all the *stats parameters from external APIs that don't need them anymore.
Russell Belfer 4c47a8bc 2012-10-17T14:14:51 Merge pull request #968 from arrbee/diff-support-typechange Support TYPECHANGE records in status and adjust checkout accordingly
nulltoken c4f68b32 2012-10-15T07:06:22 clone: fix detection of remote HEAD
nulltoken 4d968f13 2012-10-15T06:12:57 clone: Explicit support of no-checkout option
Russell Belfer 0d64bef9 2012-10-05T15:56:57 Add complex checkout test and then fix checkout This started as a complex new test for checkout going through the "typechanges" test repository, but that revealed numerous issues with checkout, including: * complete failure with submodules * failure to create blobs with exec bits * problems when replacing a tree with a blob because the tree "example/" sorts after the blob "example" so the delete was being processed after the single file blob was created This fixes most of those problems and includes a number of other minor changes that made it easier to do that, including improving the TYPECHANGE support in diff/status, etc.
Michael Schubert aa4437f6 2012-10-09T00:51:43 Fix compiler warnings * tests-clar/status: remove an unused variable * clone: fix -Wmaybe-uninitialized warning
nulltoken bf0e62a2 2012-10-07T12:50:18 clone: fix cloning of empty repository
nulltoken d280c71b 2012-09-26T19:22:21 clone: leverage refspec transform
nulltoken 70edc1b0 2012-09-26T11:05:12 clone: align type casing with convention
nulltoken 7eca3c56 2012-09-22T12:50:18 clone: deploy git_repository_set_head() usage
nulltoken 096d9e94 2012-10-07T21:00:46 remote: use constants for well-known names
nulltoken 74a24005 2012-09-21T10:28:20 refs: use constants for well-known names
nulltoken 3aa443a9 2012-08-20T16:56:45 checkout: introduce git_checkout_tree()
Russell Belfer f4ea176f 2012-09-14T10:31:40 Remove unnecessary include I don't think clone.c needs in #include dirent.h and it is not portable, so let's just get rid of it.
nulltoken 35d2e449 2012-08-20T11:26:02 checkout: cleanup misplaced declaration
Ben Straub aa549d32 2012-08-01T15:09:05 Clean up a TODO comment.
Ben Straub b31667fb 2012-07-27T20:29:06 Checkout: add head- and ref-centric checkouts. Renamed git_checkout_index to what it really was, and removed duplicate code from clone.c. Added git_checkout_ref, which updates HEAD and hands off to git_checkout_head. Added tests for the options the caller can pass to git_checkout_*.
Ben Straub 4d83399d 2012-07-27T11:55:58 Adjust for msvc pedantry.
Ben Straub 8a155a04 2012-07-27T11:49:34 Fix mismatched git_branch_create args.
Ben Straub 7affe23d 2012-07-27T11:23:44 Use new git_remote_update_tips signature.