src/checkout.c


Log

Author Commit Date CI Message
Russell Belfer 25babd02 2014-01-30T11:38:59 Fix checkout NONE to not remove file If you are checking out NONE, then don't remove.
Russell Belfer 71ae7601 2014-01-30T11:30:16 Force explicit remove of files instead of defer 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.
Carlos Martín Nieto 9950bb4e 2014-01-24T20:23:17 diff: rename the file's 'oid' to 'id' In the same vein as the previous commits in this series.
Carlos Martín Nieto d541170c 2014-01-24T11:36:41 index: rename an entry's id to 'id' This was not converted when we converted the rest, so do it now.
Ben Straub ab4bcc03 2014-01-22T14:14:37 Plug a small memory leak
Edward Thomson e8b81c69 2014-01-22T13:24:32 Preserve tree filemode in index during checkout 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.
Edward Thomson 0ef19fe1 2014-01-20T17:13:55 Merge submodules
Edward Thomson 6891a862 2014-01-19T18:12:22 Load merge.conflictstyle setting from config
Edward Thomson e651e8e2 2014-01-19T15:05:08 Introduce diff3 mode for checking out conflicts
Edward Thomson 6b92c99b 2014-01-19T01:20:25 Don't try to merge binary files
Edward Thomson c1d648c5 2014-01-08T18:29:42 merge_file should use more aggressive levels 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.
Edward Thomson bf4a577c 2013-12-13T10:10:32 Overwrite ignored directories on checkout
Edward Thomson 81a2012d 2013-12-12T11:30:50 Overwrite ignored files on checkout
Russell Belfer 9cfce273 2013-12-12T12:11:38 Cleanups, renames, and leak fixes 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.
Russell Belfer cbd04896 2013-12-10T14:38:35 Fix checkout notify callback docs and tests 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.
Russell Belfer 26c1cb91 2013-12-09T09:44:03 One more rename/cleanup for callback err functions
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 fcd324c6 2013-12-06T15:04:31 Add git_vector_free_all 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.
Russell Belfer 96869a4e 2013-12-03T16:45:39 Improve GIT_EUSER handling 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.
Edward Thomson 1d3a8aeb 2013-11-04T18:28:57 move mode_t to filebuf_open instead of _commit
Vicent Martí 44acdd1f 2013-11-04T08:09:58 Merge pull request #1937 from scunz/checkout_assert Don't assert in git_checkout_tree
Sascha Cunz 7b3959b2 2013-11-02T03:45:32 Checkout: git_checkout_head is git_checkout_tree without a treeish 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.
Sascha Cunz 35221441 2013-11-02T03:43:34 Checkout: Don't assert if treeish is NULL 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.
Sascha Cunz 10749f6c 2013-11-02T03:20:05 Checkout: Unifiy const-ness of `opts` parameter Since all 3 checkout APIs perform the same operation with the options, all of them should use the same const-ness.
Russell Belfer 8e5a8ef8 2013-11-01T09:51:01 Convert git_index_read to have a "force" flag This is a little more intuitive than the turned-around option that I originally wrote.
Russell Belfer 4bf630b6 2013-10-31T14:36:52 Make diff and status perform soft index reload 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.
Vicent Marti 95352b70 2013-11-01T16:55:20 checkout: Remove unused vector
Vicent Martí 1c74686e 2013-10-22T11:55:54 Merge pull request #1897 from libgit2/split-patch-from-diff RFC: Proposed reworking of diff APIs
Edward Thomson c929d6b7 2013-10-09T18:26:42 Move path prefixed help to path.h
Edward Thomson 7fa73de1 2013-09-23T17:52:40 Move functions in checkout_conflicts to checkout.c It seemed exceptionally silly to have a split there where no split needed to be.
Edward Thomson 216f97e4 2013-09-23T09:47:47 Two-step conflict checkout (load / perform) 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.
Edward Thomson cfae7f85 2013-08-09T20:23:36 Honor UPDATE_ONLY bit when checking out conflicts
Edward Thomson 629b661c 2013-07-17T09:49:56 checkout (from index) can write conflicts
Russell Belfer 3ff1d123 2013-10-11T14:51:54 Rename diff objects and split patch.h 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.
Russell Belfer 14997dc5 2013-10-08T12:45:43 More filemode cleanups for FAT on MacOS 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.
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.
Russell Belfer 0e32635f 2013-09-12T14:47:15 Move binary check to CRLF filter itself 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
Russell Belfer a9f51e43 2013-09-11T22:00:36 Merge git_buf and git_buffer 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.
Russell Belfer 4b11f25a 2013-09-11T16:38:33 Add ident filter 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.
Russell Belfer 2a7d224f 2013-09-10T16:33:32 Extend public filter api with filter lists 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.
Russell Belfer 85d54812 2013-08-28T16:44:04 Create public filter object and use it 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.
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.
Russell Belfer a7fcc44d 2013-09-05T16:14:32 Better macro name for is-exec-bit-set test
Russell Belfer f240acce 2013-09-05T11:20:12 Add more file mode permissions macros This adds some more macros for some standard operations on file modes, particularly related to permissions, and then updates a number of places around the code base to use the new macros.
Russell Belfer d2ce27dd 2013-06-24T23:16:06 Add public API for pathspec matching This adds a new public API for compiling pathspecs and matching them against the working directory, the index, or a tree from the repository. This also reworks the pathspec internals to allow the sharing of code between the existing internal usage of pathspec matching and the new external API. While this is working and the new API is ready for discussion, I think there is still an incorrect behavior in which patterns are always matched against the full path of an entry without taking the subdirectories into account (so "s*" will match "subdir/file" even though it wouldn't with core Git). Further enhancements are coming, but this was a good place to take a functional snapshot.
Russell Belfer 6a15e8d2 2013-06-21T12:26:36 Loosen ensure_not_bare rules in checkout With the new target directory option to checkout, the non-bareness of the repository should be checked much later in the parameter validation process - actually that check was already in place, but I was doing it redundantly in the checkout APIs. This removes the now unnecessary early check for bare repos. It also adds some other parameter validation and makes it so that implied parameters can actually be passed as NULL (i.e. if you pass a git_index, you don't have to pass the git_repository - we can get it from index).
Russell Belfer 9094ae5a 2013-06-21T11:51:16 Add target directory to checkout This adds the ability for checkout to write to a target directory instead of having to use the working directory of the repository. This makes it easier to do exports of repository data and the like. This is similar to, but not quite the same as, the --prefix option to `git checkout-index` (this will always be treated as a directory name, not just as a simple text prefix). As part of this, the workdir iterator was extended to take the path to the working directory as a parameter and fallback on the git_repository_workdir result only if it's not specified. Fixes #1332
Russell Belfer 36fd9e30 2013-06-21T11:20:54 Fix checkout of modified file when missing from wd This fixes the checkout case when a file is modified between the baseline and the target and yet missing in the working directory. The logic for that case appears to have been wrong. This also adds a useful checkout notify callback to the checkout test helpers that will count notifications and also has a debug mode to visualize what checkout thinks that it's doing.
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.
Russell Belfer cee695ae 2013-05-31T12:18:43 Make iterators use GIT_ITEROVER & smart advance 1. internal iterators now return GIT_ITEROVER when you go past the last item in the iteration. 2. git_iterator_advance will "advance" to the first item in the iteration if it is called immediately after creating the iterator, which allows a simpler idiom for basic iteration. 3. if git_iterator_advance encounters an error reading data (e.g. a missing tree or an unreadable file), it returns the error but also attempts to advance past the invalid data to prevent an infinite loop. Updated all tests and internal usage of iterators to account for these new behaviors.
Russell Belfer 4742148d 2013-05-20T13:41:39 Add more diff rename detection tests This adds a bunch more rename detection tests including checks vs the working directory, the new exact match options, some more whitespace variants, etc. This also adds a git_futils_writebuffer helper function and uses it in checkout. This is mainly added because I wanted an easy way to write out a git_buf to disk inside my test code.
Russell Belfer dcb0f7c0 2013-05-15T14:54:02 Fix checkout of submodules with no .gitmodules It is possible for there to be a submodule in a repository with no .gitmodules file (for example, if the user forgot to commit the .gitmodules file). In this case, core Git will just create an empty directory as a placeholder for the submodule but otherwise ignore it. We were generating an error and stopping the checkout. This makes our behavior match that of core git.
Russell Belfer 55d3a390 2013-05-15T14:52:12 Remove old symlinks before updating Unlike blob updates, symlink updates cannot be done "in place" writing over an old symlink. This means that in checkout when we realize that we can safely update a symlink, we still need to remove the old one before writing the new.
nulltoken 1fed6b07 2013-05-13T21:57:37 Fix trailing whitespaces
Linquize 0cb16fe9 2013-05-15T20:26:55 Unify whitespaces to tabs
Brad Morgan fbcab44b 2013-05-14T16:03:09 Create directory for symlink before creating symlink
Edward Thomson e09d18ee 2013-05-03T18:39:44 allow checkout to proceed when a dir to be removed is in use (win32)
Edward Thomson 0cc7d8df 2013-05-01T09:50:40 allow empty dirs to exist when doing checkout
Vicent Marti e1807113 2013-05-01T15:31:23 merge: Warning noise
Russell Belfer b7f167da 2013-04-29T13:52:12 Make git_oid_cmp public and add git_oid__cmp
Russell Belfer eac76c23 2013-04-22T14:27:36 Use config cache where possible This converts many of the config lookups that are done around the library to use the repository config cache. This was everything I could find that wasn't part of diff (which requires a larger fix).
Russell Belfer badd85a6 2013-04-10T17:10:17 Use git_odb_object_data/_size whereever possible This uses the odb object accessors so we can change the internals more easily...
Vicent Marti 8842c75f 2013-04-03T22:30:07 What has science done.
Edward Thomson 0da62c5c 2013-04-17T10:52:49 checkout: use cache when possible to determine if workdir item is dirty If the on-disk file has been staged (it's stat data matches the stat data in the cache) then we need not hash the file to determine whether it differs from the checkout target; instead we can simply use the oid in the index. This prevents recomputing a file's hash unnecessarily, prevents loading the file (when filtering) and prevents edge cases where filters suggest that a file is dirty immediately after git writes the file.
Edward Thomson 54a1a042 2013-03-29T11:26:12 remove unmerged files during reset hard
Edward Thomson d828f118 2013-03-25T18:16:02 don't stat until the file is written
Russell Belfer 3658e81e 2013-03-25T14:20:07 Move crlf conversion into buf_text This adds crlf/lf conversion functions into buf_text with more efficient implementations that bypass the high level buffer functions. They attempt to minimize the number of reallocations done and they directly write the buffer data as needed if they know that there is enough memory allocated to memcpy data. Tests are added for these new functions. The crlf.c code is updated to use the new functions. Removed the include of buf_text.h from filter.h and just include it more narrowly in the places that need it.
Russell Belfer d85296ab 2013-03-14T13:50:54 Fix valgrind issues (and mmap fallback for diff) This fixes a number of issues identified by valgrind - mostly missed free calls. Inside valgrind, mmap() may fail which causes some of the diff tests to fail. This adds a fallback code path to diff_output.c:get_workdir_content() where is the mmap() fails the code will now try to read the file data directly into allocated memory (which is what it would do if the data needed to be filtered anyhow).
Russell Belfer 9bea03ce 2013-03-06T15:16:34 Add INCLUDE_TREES, DONT_AUTOEXPAND iterator flags This standardizes iterator behavior across all three iterators (index, tree, and working directory). Previously the working directory iterator behaved differently from the other two. Each iterator can now operate in one of three modes: 1. *No tree results, auto expand trees* means that only non- tree items will be returned and when a tree/directory is encountered, we will automatically descend into it. 2. *Tree results, auto expand trees* means that results will be given for every item found, including trees, but you only need to call normal git_iterator_advance to yield every item (i.e. trees returned with pre-order iteration). 3. *Tree results, no auto expand* means that calling the normal git_iterator_advance when looking at a tree will not descend into the tree, but will skip over it to the next entry in the parent. Previously, behavior 1 was the only option for index and tree iterators, and behavior 3 was the only option for workdir. The main public API implications of this are that the `git_iterator_advance_into()` call is now valid for all iterators, not just working directory iterators, and all the existing uses of working directory iterators explicitly use the GIT_ITERATOR_DONT_AUTOEXPAND (for now). Interestingly, the majority of the implementation was in the index iterator, since there are no tree entries there and now have to fake them. The tree and working directory iterators only required small modifications.
Russell Belfer cc216a01 2013-03-05T16:29:04 Retire spoolandsort iterator Since the case sensitivity is moved into the respective iterators, this removes the spoolandsort iterator code.
Russell Belfer 169dc616 2013-03-05T16:10:05 Make iterator APIs consistent with standards The iterator APIs are not currently consistent with the parameter ordering of the rest of the codebase. This rearranges the order of parameters, simplifies the naming of a number of functions, and makes somewhat better use of macros internally to clean up the iterator code. This also expands the test coverage of iterator functionality, making sure that case sensitive range-limited iteration works correctly.
Edward Thomson 5bddabcc 2013-03-04T17:40:48 clear REUC on checkout
Vicent Martí e68e33f3 2013-02-27T14:50:32 Merge pull request #1233 from arrbee/file-similarity-metric Add file similarity scoring to diff rename/copy detection
Edward Thomson 395509ff 2013-02-27T14:47:39 don't dereference at the end of the workdir iterator
Russell Belfer 71a3d27e 2013-02-08T10:06:47 Replace diff delta binary with flags Previously the git_diff_delta recorded if the delta was binary. This replaces that (with no net change in structure size) with a full set of flags. The flag values that were already in use for individual git_diff_file objects are reused for the delta flags, too (along with renaming those flags to make it clear that they are used more generally). This (a) makes things somewhat more consistent (because I was using a -1 value in the "boolean" binary field to indicate unset, whereas now I can just use the flags that are easier to understand), and (b) will make it easier for me to add some additional flags to the delta object in the future, such as marking the results of a copy/rename detection or other deltas that might want a special indicator. While making this change, I officially moved some of the flags that were internal only into the private diff header. This also allowed me to remove a gross hack in rename/copy detect code where I was overwriting the status field with an internal value.
Russell Belfer 56543a60 2013-02-15T16:02:45 Clear up warnings from cppcheck The cppcheck static analyzer generates warnings for a bunch of places in the libgit2 code base. All the ones fixed in this commit are actually false positives, but I've reorganized the code to hopefully make it easier for static analysis tools to correctly understand the structure. I wouldn't do this if I felt like it was making the code harder to read or worse for humans, but in this case, these fixes don't seem too bad and will hopefully make it easier for better analysis tools to get at any real issues.
yorah 943700ec 2013-01-18T16:37:13 Return the matched pathspec pattern in `git_pathspec_match_path` Instead of returning directly the pattern as the return value, I used an out parameter, because the function also tests if the passed pathspecs vector is empty. If yes, it considers that the path "matches", but in that case there is no matched pattern per se.
Edward Thomson 6e959708 2013-01-17T13:11:57 cache should contain on-disk (filtered) file size
Russell Belfer 134d8c91 2013-01-08T15:53:13 Update iterator API with flags for ignore_case This changes the iterator API so that flags can be passed in to the constructor functions to control the ignore_case behavior. At this point, the flags are not supported on tree iterators (i.e. there is no functional change over the old API), but the API changes are all made to accomodate this. By the way, I went with a flags parameter because in the future I have a couple of other ideas for iterator flags that will make it easier to fix some diff/status/checkout bugs.
nulltoken 2a3b3e03 2013-01-12T19:27:31 checkout: Teach checkout to cope with orphaned Head Fix #1236
Philip Kelley 359316b5 2013-01-11T17:16:55 Merge pull request #1215 from phkelley/binaryunicode Add a failing test for CRLF filters
Russell Belfer ad10db2a 2013-01-10T15:59:36 Check for binary blobs in checkout This adds a git_buf_text_is_binary check to blobs before applying filters when the blob data is being written to disk.
nulltoken 4a0ac175 2013-01-10T23:27:13 checkout: Deploy EMERGECONFLICT usage
Russell Belfer 40342bd2 2013-01-10T15:15:37 Add GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH This adds an option to checkout a la the diff option to turn off fnmatch evaluation for pathspec entries. This can be useful to make sure your "pattern" in really interpretted as an exact file match only.
Edward Thomson 359fc2d2 2013-01-08T17:07:25 update copyrights
Russell Belfer 817d6251 2013-01-03T16:56:27 Fix checkout of index-only dirs and prefixed paths There are a couple of checkout bugs fixed here. One is with untracked working directory entries that are prefixes of tree entries but not in a meaningful way (i.e. "read" is a prefix of "readme.txt" but doesn't interfere in any way). The second bug is actually a redo of 07edfa0fc640f85f95507c3101e77accd7d2bf0d where directory entries in the index that are not in the diff were not being removed correctly. That fix remedied one case but broke another.
Russell Belfer d8889d2b 2013-01-03T14:08:53 Fix checkout bug rmv untracked trees from index When checking out with the GIT_CHECKOUT_REMOVE_UNTRACKED option and there was an entire tree in the working directory and in the index that is not in the baseline nor target commit, the tree was correctly(?) removed from the working directory but was not successfully removed from the index. This fixes that and adds a test of the functionality.
Russell Belfer dde7602a 2013-01-03T13:22:34 Fix memory leak with checkout tree iterator
Russell Belfer 0d70f650 2013-01-03T10:51:18 Fixing checkout UPDATE_ONLY and adding tests This adds a bunch of new checkout tests and in the process I found a bug in the GIT_CHECKOUT_UPDATE_ONLY flag which I fixed.
Russell Belfer 77cffa31 2013-01-02T17:14:00 Simplify checkout documentation This moves a lot of the detailed checkout documentation into a new file (docs/checkout-internals.md) and simplifies the public docs for the checkout API.
Russell Belfer e0548c0e 2013-01-02T17:09:07 Fix some submodule and typechange checkout cases There were a bunch of small bugs in the checkout code where I was assuming that a typechange was always from a tree to a blob or vice versa. This fixes up most of those cases. Also, there were circumstances where the submodule definitions were changed by the checkout and the submodule data was not getting reloaded properly before the new submodules were checked out.
Russell Belfer 16a666d3 2013-01-02T17:05:54 Fix workdir notifications and removals The notifications were broken from the various iterations over this code and were not returning working dir item data correctly. Also, workdir items that were alphabetically after the last item in diff were not being processed.
Russell Belfer 546d65a8 2013-01-02T17:01:34 Fix up spoolandsort iterator usage The spoolandsort iterator changes got sort-of cherry picked out of this branch and so I dropped the commit when rebasing; however, there were a few small changes that got dropped as well (since the version merged upstream wasn't quite the same as what I dropped).
Russell Belfer 5cf9875a 2012-12-18T15:19:24 Add index updating to checkout Make checkout update entries in the index for all files that are updated and/or removed, unless flag GIT_CHECKOUT_DONT_UPDATE_INDEX is given. To do this, iterators were extended to allow a little more introspection into the index being iterated over, etc.
Russell Belfer 7e5c8a5b 2012-12-10T15:31:43 More checkout improvements This flips checkout back to be driven off the changes between the baseline and the target trees. This reinstates the complex code for tracking the contents of the working directory, but overall, I think the resulting logic is easier to follow.
Russell Belfer cf208031 2012-12-06T13:36:17 Rework checkout internals (again) I've tried to map out the detailed behaviors of checkout and make sure that we're handling the various cases correctly, along with providing options to allow us to emulate "git checkout" and "git checkout-index" with the various flags. I've thrown away flags in the checkout API that seemed like clutter and added some new ones. Also, I've converted the conflict callback to a general notification callback so we can emulate "git checkout" output and display "dirty" files. As of this commit, the new behavior is not working 100% but some of that is probably baked into tests that are not testing the right thing. This is a decent snapshot point, I think, along the way to getting the update done.
Russell Belfer f616a36b 2012-12-27T22:25:52 Make spoolandsort a pushable iterator behavior An earlier change to `git_diff_from_iterators` introduced a memory leak where the allocated spoolandsort iterator was not returned to the caller and thus not freed. One proposal changes all iterator APIs to use git_iterator** so we can reallocate the iterator at will, but that seems unexpected. This commit makes it so that an iterator can be changed in place. The callbacks are isolated in a separate structure and a pointer to that structure can be reassigned by the spoolandsort extension. This means that spoolandsort doesn't create a new iterator; it just allocates a new block of callbacks (along with space for its own extra data) and swaps that into the iterator. Additionally, since spoolandsort is only needed to switch the case sensitivity of an iterator, this simplifies the API to only take the ignore_case boolean and to be a no-op if the iterator already matches the requested case sensitivity.
Russell Belfer 56c72b75 2012-12-17T11:00:53 Fix diff constructor name order confusion The diff constructor functions had some confusing names, where the "old" side of the diff was coming after the "new" side. This reverses the order in the function name to make it less confusing. Specifically... * git_diff_index_to_tree becomes git_diff_tree_to_index * git_diff_workdir_to_index becomes git_diff_index_to_workdir * git_diff_workdir_to_tree becomes git_diff_tree_to_workdir
Russell Belfer 9950d27a 2012-12-06T13:26:58 Clean up iterator APIs This removes the need to explicitly pass the repo into iterators where the repo is implied by the other parameters. This moves the repo to be owned by the parent struct. Also, this has some iterator related updates to the internal diff API to lay the groundwork for checkout improvements.
Vicent Martí e05ca13f 2012-12-05T11:47:19 Merge pull request #1115 from ben/struct-versions Version info for public structs