summaryrefslogtreecommitdiff
path: root/src/checkout.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Clean up index snapshot function namingRussell Belfer2014-04-171-3/+3
| | | | | Clear up some of the various "find" functions and the snapshot API naming to be things I like more.
* Some index internals refactoringRussell Belfer2014-04-171-3/+7
| | | | | | | | Again, laying groundwork for some index iterator changes, this contains a bunch of code refactorings for index internals that should make it easier down the line to add locking around index modifications. Also this removes the redundant prefix_position function and fixes some potential memory leaks.
* Some vector utility tweaksRussell Belfer2014-04-171-2/+6
| | | | | This is just laying some groundwork for internal index changes that I'm working on.
* checkout: Fix submodule_is_config_only's return valueJiri Pospisil2014-04-021-1/+1
|
* Fix submodule leaks and invalid referencesRussell Belfer2014-03-251-5/+9
| | | | | | | This cleans up some places I missed that could hold onto submodule references and cleans up the way in which the repository cache is both reloaded and released so that existing submodule references aren't destroyed inappropriately.
* Make submodules externally refcountedRussell Belfer2014-03-251-11/+15
| | | | | | | | `git_submodule` objects were already refcounted internally in case the submodule name was different from the path at which it was stored. This makes that refcounting externally used as well, so `git_submodule_lookup` and `git_submodule_add_setup` return an object that requires a `git_submodule_free` when done.
* Introduce git_merge_file for consumersEdward Thomson2014-03-201-27/+16
|
* git_checkout_opts -> git_checkout_optionsBen Straub2014-03-061-14/+14
|
* Added function-based initializers for every options struct.Matthew Bowen2014-03-051-0/+12
| | | | The basic structure of each function is courtesy of arrbee.
* Fix checkout NONE to not remove fileRussell Belfer2014-01-301-1/+1
| | | | If you are checking out NONE, then don't remove.
* Force explicit remove of files instead of deferRussell Belfer2014-01-301-0/+2
| | | | | | | | | | | | | | | The checkout code used to defer removal of "blocking" files in checkouts until the blocked item was actually being written (since we have already checked that the removing the block is acceptable according to the update rules). Unfortunately, this resulted in an intermediate index state where both the blocking and new items were in the index which is no longer allowed. Now we just remove the blocking item in the first pass so it never needs to coexist. In cases where there are typechanges, this could result in a bit more churn of removing and recreating intermediate directories, but I'm going to assume that is an unusual case and the churn will not be too costly.
* diff: rename the file's 'oid' to 'id'Carlos Martín Nieto2014-01-251-7/+7
| | | | In the same vein as the previous commits in this series.
* index: rename an entry's id to 'id'Carlos Martín Nieto2014-01-251-7/+7
| | | | This was not converted when we converted the rest, so do it now.
* Plug a small memory leakBen Straub2014-01-221-1/+4
|
* Preserve tree filemode in index during checkoutEdward Thomson2014-01-221-2/+1
| | | | | | Don't try to determine whether the system supports file modes when putting the tree data in the index during checkout. The tree's mode is canonical and did not come from stat(2) in the first place.
* Merge submodulesEdward Thomson2014-01-201-2/+19
|
* Load merge.conflictstyle setting from configEdward Thomson2014-01-201-0/+23
|
* Introduce diff3 mode for checking out conflictsEdward Thomson2014-01-201-1/+4
|
* Don't try to merge binary filesEdward Thomson2014-01-201-2/+45
|
* merge_file should use more aggressive levelsEdward Thomson2014-01-201-1/+2
| | | | | | | | | | | The default merge_file level was XDL_MERGE_MINIMAL, which will produce conflicts where there should not be in the case where both sides were changed identically. Change the defaults to be more aggressive (XDL_MERGE_ZEALOUS) which will more aggressively compress non-conflicts. This matches git.git's defaults. Increase testing around reverting a previously reverted commit to illustrate this problem.
* Overwrite ignored directories on checkoutEdward Thomson2013-12-131-2/+5
|
* Overwrite ignored files on checkoutEdward Thomson2013-12-131-6/+12
|
* Cleanups, renames, and leak fixesRussell Belfer2013-12-121-1/+1
| | | | | | | | | 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.
* Fix checkout notify callback docs and testsRussell Belfer2013-12-111-2/+2
| | | | | | | The checkout notify callback behavior on non-zero return values was not being tested. This adds tests, fixes a bug with positive values, and clarifies the documentation to make it clear that the checkout can be canceled via this mechanism.
* One more rename/cleanup for callback err functionsRussell Belfer2013-12-111-4/+7
|
* Remove converting user error to GIT_EUSERRussell Belfer2013-12-111-125/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-8/+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.
* Improve GIT_EUSER handlingRussell Belfer2013-12-111-10/+7
| | | | | | | | | | | 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.
* move mode_t to filebuf_open instead of _commitEdward Thomson2013-11-041-2/+2
|
* Merge pull request #1937 from scunz/checkout_assertVicent Martí2013-11-041-19/+18
|\ | | | | Don't assert in git_checkout_tree
| * Checkout: git_checkout_head is git_checkout_tree without a treeishSascha Cunz2013-11-021-13/+1
| | | | | | | | | | | | | | The last commit taught git_checkout_tree to actually do something meaningfull, when treeish was NULL. This lets us rewrite git_checkout_head to simply call git_checkout_tree without giving it a treeish.
| * Checkout: Don't assert if treeish is NULLSascha Cunz2013-11-021-4/+15
| | | | | | | | | | | | | | | | In git_checkout_tree, the first check tests if either repo or treeish is NULL and says that eithor of them has to have a valid value. But there is no code to handle the treeish == NULL case. So, do something meaningful in that case: use HEAD instead.
| * Checkout: Unifiy const-ness of `opts` parameterSascha Cunz2013-11-021-2/+2
| | | | | | | | | | Since all 3 checkout APIs perform the same operation with the options, all of them should use the same const-ness.
* | Convert git_index_read to have a "force" flagRussell Belfer2013-11-011-1/+1
| | | | | | | | | | This is a little more intuitive than the turned-around option that I originally wrote.
* | Make diff and status perform soft index reloadRussell Belfer2013-11-011-1/+1
|/ | | | | | | | | | | | | | | | | | | | | This changes `git_index_read` to have two modes - a hard index reload that always resets the index to match the on-disk data (which was the old behavior) and a soft index reload that uses the timestamp / file size information and only replaces the index data if the file on disk has been modified. This then updates the git_status code to do a soft reload unless the new GIT_STATUS_OPT_NO_REFRESH flag is passed in. This also changes the behavior of the git_diff functions that use the index so that when an index is not explicitly passed in (i.e. when the functions call git_repository_index for you), they will also do a soft reload for you. This intentionally breaks the file signature of git_index_read because there has been some confusion about the behavior previously and it seems like all existing uses of the API should probably be examined to select the desired behavior.
* checkout: Remove unused vectorVicent Marti2013-11-011-1/+0
|
* Merge pull request #1897 from libgit2/split-patch-from-diffVicent Martí2013-10-221-2/+2
|\ | | | | RFC: Proposed reworking of diff APIs
| * Rename diff objects and split patch.hRussell Belfer2013-10-111-2/+2
| | | | | | | | | | | | This makes no functional change to diff but renames a couple of the objects and splits the new git_patch (formerly git_diff_patch) into a new header file.
* | Move path prefixed help to path.hEdward Thomson2013-10-161-38/+13
| |
* | Move functions in checkout_conflicts to checkout.cEdward Thomson2013-10-161-8/+696
| | | | | | | | | | It seemed exceptionally silly to have a split there where no split needed to be.
* | Two-step conflict checkout (load / perform)Edward Thomson2013-10-161-23/+31
| | | | | | | | | | | | | | Move conflict handling into two steps: load the conflicts and then apply the conflicts. This is more compatible with the existing checkout implementation and makes progress reporting more sane.
* | Honor UPDATE_ONLY bit when checking out conflictsEdward Thomson2013-10-161-2/+2
| |
* | checkout (from index) can write conflictsEdward Thomson2013-10-161-38/+53
|/
* More filemode cleanups for FAT on MacOSRussell Belfer2013-10-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | This cleans up some additional issues. The main change is that on a filesystem that doesn't support mode bits, libgit2 will now create new blobs with GIT_FILEMODE_BLOB always instead of being at the mercy to the filesystem driver to report executable or not. This means that if "core.filemode" lies and claims that filemode is not supported, then we will ignore the executable bit from the filesystem. Previously we would have allowed it. This adds an option to the new git_repository_reset_filesystem to recurse through submodules if desired. There may be other types of APIs that would like a "recurse submodules" option, but this one is particularly useful. This also has a number of cleanups, etc., for related things including trying to give better error messages when problems come up from the filesystem. For example, the FAT filesystem driver on MacOS appears to return errno EINVAL if you attempt to write a filename with invalid UTF-8 in it. We try to capture that with a better error message now.
* clone: const-ify checkout optionsCarlos Martín Nieto2013-10-021-3/+3
| | | | | 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.
* Move binary check to CRLF filter itselfRussell Belfer2013-09-171-1/+1
| | | | | | | | | | | | Checkout should not reject binary files from filters, as a filter may actually wish to operate on binary files. The CRLF filter should reject binary files itself if it wishes to. Moreover, the CRLF filter requires this logic so that users can emulate the checkout data in their odb -> workdir filtering. Conflicts: src/checkout.c src/crlf.c
* Merge git_buf and git_bufferRussell Belfer2013-09-171-5/+4
| | | | | | | | | | | This makes the git_buf struct that was used internally into an externally available structure and eliminates the git_buffer. As part of that, some of the special cases that arose with the externally used git_buffer were blended into the git_buf, such as being careful about git_buf objects that may have a NULL ptr and allowing for bufs with a valid ptr and size but zero asize as a way of referring to externally owned data.
* Add ident filterRussell Belfer2013-09-171-1/+1
| | | | | | | This adds the ident filter (that knows how to replace $Id$) and tweaks the filter APIs and code so that git_filter_source objects actually have the updated OID of the object being filtered when it is a known value.
* Extend public filter api with filter listsRussell Belfer2013-09-171-25/+13
| | | | | | | | | | | This moves the git_filter_list into the public API so that users can create, apply, and dispose of filter lists. This allows more granular application of filters to user data outside of libgit2 internals. This also converts all the internal usage of filters to the public APIs along with a few small tweaks to make it easier to use the public git_buffer stuff alongside the internal git_buf.
* Create public filter object and use itRussell Belfer2013-09-171-36/+20
| | | | | | | This creates include/sys/filter.h with a basic definition of a git_filter and then converts the internal code to use it. There are related internal objects (git_filter_list) that we will want to publish at some point, but this is a first step.