summaryrefslogtreecommitdiff
path: root/src/checkout.c
Commit message (Collapse)AuthorAgeFilesLines
...
* checkout_index: Remove stage 0 when checking out conflictsEdward Thomson2014-11-061-3/+17
|
* checkout_index: remove conflicts when checking out new filesEdward Thomson2014-11-061-48/+137
|
* config: remove the refresh function and backend fieldcmn/config-refresh-removeCarlos Martín Nieto2014-10-231-2/+1
| | | | | | We have been refreshing on read and write for a while now, so git_config_refresh() is at best a no-op, and might just end up wasting cycles.
* Don't copy buffer in checkout unless neededEdward Thomson2014-10-131-6/+8
|
* Ensure filters (i.e. CRLF) are applied when checking out conflict contentJacques Germishuys2014-10-131-3/+19
|
* Merge remote-tracking branch 'origin/master' into ↵Alan Rogers2014-07-221-23/+116
|\ | | | | | | fix-git-status-list-new-unreadable-folder
| * git_checkout_index: checkout other indexesEdward Thomson2014-07-011-23/+116
| | | | | | | | | | | | | | | | git_checkout_index can now check out other git_index's (that are not necessarily the repository index). This allows checkout_index to use the repository's index for stat cache information instead of the index data being checked out. git_merge and friends now check out their indexes directly instead of trying to blend it into the running index.
* | Start adding GIT_DELTA_UNREADABLE and GIT_STATUS_WT_UNREADABLE.Alan Rogers2014-05-201-0/+2
|/
* Add filter options and ALLOW_UNSAFERussell Belfer2014-05-061-1/+2
| | | | | | | | | Diff and status do not want core.safecrlf to actually raise an error regardless of the setting, so this extends the filter API with an additional options flags parameter and adds a flag so that filters can be applied with GIT_FILTER_OPT_ALLOW_UNSAFE, indicating that unsafe filter application should be downgraded from a failure to a warning.
* 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.
* Add diff option to update index stat cacheRussell Belfer2014-05-021-1/+1
| | | | | | | | | | When diff is scanning the working directory, if it finds a file where it is not sure if the index entry matches the working dir, it will recalculate the OID (which is pretty expensive). This adds a new flag to diff so that if the OID calculation finds that the file actually has not changed (i.e. just the modified time was altered or such), then it will refresh the stat cache in the index so that future calls to diff will not have to check the oid again.
* Lay groundwork for updating stat cache in diffRussell Belfer2014-05-021-2/+1
| | | | | | | | | | | This reorganized the diff OID calculation to make it easier to correctly update the stat cache during a diff once the flags to do so are enabled. This includes marking the path of a git_index_entry as const so we can make a "fake" git_index_entry with a "const char *" path and not get warnings. I was a little surprised at how unobtrusive this change was, but I think it's probably a good thing.
* Add build option for diff internal statisticsRussell Belfer2014-05-021-2/+1
|
* Treat ignored, empty, and untracked dirs differentRussell Belfer2014-04-231-5/+5
| | | | | | In the iterator, distinguish between ignores and empty directories so that diff and status can ignore empty directories, but checkout and stash can treat them as untracked items.
* Make checkout match diff for untracked/ignored dirRussell Belfer2014-04-221-28/+57
| | | | | | | | | | | | | | | | | | When diff finds an untracked directory, it emulates Git behavior by looking inside the directory to see if there are any untracked items inside it. If there are only ignored items inside the dir, then diff considers it ignored, even if there is no direct ignore rule for it. Checkout was not copying this behavior - when it found an untracked directory, it just treated it as untracked. Unfortunately, when combined with GIT_CHECKOUT_REMOVE_UNTRACKED, this made is seem that checkout (and stash, which uses checkout) was removing ignored items when you had only asked it to remove untracked ones. This commit moves the logic for advancing past an untracked dir while scanning for non-ignored items into an iterator helper fn, and uses that for both diff and checkout.
* Make stash and checkout ignore contained reposRussell Belfer2014-04-221-2/+15
| | | | | | | | | | | To emulate git, stash should not remove untracked git repositories inside the parent repo, and checkout's REMOVE_UNTRACKED should also skip over these items. `git stash` actually prints a warning message for these items. That should be possible with a checkout notify callback if you wanted to, although it would require a bit of extra logic as things are at the moment.
* 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.