summaryrefslogtreecommitdiff
path: root/src/checkout.c
Commit message (Collapse)AuthorAgeFilesLines
* diff: preserve original mode in the indexEdward Thomson2015-06-201-1/+1
| | | | | | | When updating the index during a diff, preserve the original mode, which prevents us from dropping the mode to what we have interpreted as on our system (eg, what the working directory claims it to be, which may be a lie on some systems.)
* checkout: allow workdir to contain checkout targetethomson/racy-diffcmn/racy-diffEdward Thomson2015-06-161-3/+14
| | | | | | When checking out some file 'foo' that has been modified in the working directory, allow the checkout to proceed (do not conflict) if 'foo' is identical to the target of the checkout.
* Rename GIT_EMERGECONFLICT to GIT_ECONFLICTEdward Thomson2015-05-291-3/+3
| | | | | | | | | | We do not error on "merge conflicts"; on the contrary, merge conflicts are a normal part of merging. We only error on "checkout conflicts", where a change exists in the index or the working directory that would otherwise be overwritten by performing the checkout. This *may* happen during merge (after the production of the new index that we're going to checkout) but it could happen during any checkout.
* checkout: allow baseline to be specified as indexEdward Thomson2015-05-111-5/+14
| | | | | | Allow the baseline to be specified as an index, so that users need not write their index to a tree just to checkout with that as the baseline.
* checkout: break case-changes into delete/addEdward Thomson2015-05-041-1/+2
| | | | | | | When checking out with a case-insensitive working directory, we want to change the case of items in the working directory to reflect changes that occured in the checkout target. Diff now has an option to break case-changing renames into delete/add.
* checkout: remove blocking dir when FORCEdEdward Thomson2015-05-041-3/+26
|
* Revert "Always checkout with case sensitive iterator"Edward Thomson2015-05-041-1/+1
| | | | This reverts commit 40d791545abfb3cb71553a27dc64129e1a9bec28.
* Fix some build warningsLeo Yang2015-04-281-1/+1
| | | | | | | | | | | | In checkout.c and filter.c we were casting a sub struct to a parent struct which breaks the strict aliasing rules in C. However we can use .parent or .base to access the parent struct to avoid the build warnings. In remote.c the local variable error was not initialized or updated in some cases. For unintialized error a build warning will be generated. So always keep error variable up-to-date.
* Merge pull request #3010 from ethomson/checkout_invalid_path_errCarlos Martín Nieto2015-03-241-1/+1
|\ | | | | checkout: report correct invalid path
| * checkout: report correct invalid pathEdward Thomson2015-03-231-1/+1
| |
* | config: borrow refcounted referencescmn/config-borrow-entryCarlos Martín Nieto2015-03-031-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the get_entry() method to return a refcounted version of the config entry, which you have to free when you're done. This allows us to avoid freeing the memory in which the entry is stored on a refresh, which may happen at any time for a live config. For this reason, get_string() has been forbidden on live configs and a new function get_string_buf() has been added, which stores the string in a git_buf which the user then owns. The functions which parse the string value takea advantage of the borrowing to parse safely and then release the entry.
* | checkout: remove `GIT_CHECKOUT_SAFE_CREATE` as a strategyEdward Thomson2015-02-271-9/+8
| |
* | checkout: upgrade to `SAFE_CREATE` when no index fileEdward Thomson2015-02-271-0/+7
|/ | | | | | When the repository does not contain an index, emulate git's behavior and upgrade to `SAFE_CREATE`. This allows us to check out repositories created with `git clone --no-checkout`.
* filter: take `temp_buf` in `git_filter_options`Edward Thomson2015-02-191-3/+2
|
* filter: add `git_filter_list__load_ext`Edward Thomson2015-02-191-6/+12
| | | | | Refactor `git_filter_list__load_with_attr_reader` into `git_filter_list__load_ext`, which takes a `git_filter_options`.
* git_filter_opt_t -> git_filter_flag_tEdward Thomson2015-02-191-2/+2
| | | | | For consistency with the rest of the library, where an opt is an options *structure*.
* checkout: let the stream writer close the fdEdward Thomson2015-02-181-2/+1
|
* git_writestream: from git_filter_streamEdward Thomson2015-02-181-5/+5
|
* checkout: maintain temporary buffer for filtersEdward Thomson2015-02-171-0/+3
| | | | | Let the filters use the checkout data's temporary buffer, instead of having to allocate new buffers each time.
* checkout: stream the blob into the filtersEdward Thomson2015-02-171-39/+82
| | | | Use the new streaming filter API during checkout.
* Remove extra semicolon outside of a functionStefan Widgren2015-02-151-1/+1
| | | | | Without this change, compiling with gcc and pedantic generates warning: ISO C does not allow extra ‘;’ outside of a function.
* checkout: introduce GIT_CHECKOUT_DONT_WRITE_INDEXEdward Thomson2015-02-141-1/+4
|
* checkout: hold seen dir paths in a mapEdward Thomson2015-02-041-38/+39
|
* attrcache: don't re-read attrs during checkoutEdward Thomson2015-02-031-3/+10
| | | | | | | | | | | During checkout, assume that the .gitattributes files aren't modified during the checkout. Instead, create an "attribute session" during checkout. Assume that attribute data read in the same checkout "session" hasn't been modified since the checkout started. (But allow subsequent checkouts to invalidate the cache.) Further, cache nonexistent git_attr_file data even when .gitattributes files are not found to prevent re-scanning for nonexistent files.
* checkout: free last created directoryEdward Thomson2015-01-231-0/+1
|
* checkout: remove files before writing new onesEdward Thomson2015-01-201-8/+48
| | | | | | | On case insensitive filesystems, we may have files in the working directory that case fold to a name we want to write. Remove those files (by default) so that we will not end up with a filename that has the unexpected case.
* checkout: drop newline in error messageEdward Thomson2015-01-201-1/+1
|
* checkout: don't recreate previous directoryEdward Thomson2015-01-201-3/+19
| | | | | Don't bother trying to recreate the previously created directory during checkout, for a modest reduction in the number of stats.
* git_path_join_unrooted: return base lenEdward Thomson2015-01-201-1/+1
| | | | | | | The documentation for `git_path_join_unrooted` states that the base length will be returned, so that consumers like checkout know where to start creating directories instead of always creating directories at the directory root.
* checkout: introduce git_checkout_perfdataEdward Thomson2015-01-201-34/+77
| | | | | Checkout can now provide performance data about the number of (some) syscalls performed using an optional callback.
* Always checkout with case sensitive iteratorEdward Thomson2014-12-231-1/+1
| | | | | | | | | On a case-insensitive filesystem, we need to deal with case-changing renames (eg, foo -> FOO) by removing the old and adding the new, exactly as if we were on a case-sensitive filesystem. Update the `checkout::tree::can_cancel_checkout_from_notify` test, now that notifications are always sent case sensitively.
* checkout: disallow bad paths on win32Edward Thomson2014-12-161-1/+27
| | | | | | | | | | | | | | | Disallow: 1. paths with trailing dot 2. paths with trailing space 3. paths with trailing colon 4. paths that are 8.3 short names of .git folders ("GIT~1") 5. paths that are reserved path names (COM1, LPT1, etc). 6. paths with reserved DOS characters (colons, asterisks, etc) These paths would (without \\?\ syntax) be elided to other paths - for example, ".git." would be written as ".git". As a result, writing these paths literally (using \\?\ syntax) makes them hard to operate with from the shell, Windows Explorer or other tools. Disallow these.
* Fixed a couple Clang warningsPierre-Olivier Latour2014-11-101-0/+4
|
* iterator: submodules are determined by an index or treecmn/submodule-and-dirCarlos Martín Nieto2014-11-071-3/+9
| | | | | | | | | | | | We cannot know from looking at .gitmodules whether a directory is a submodule or not. We need the index or tree we are comparing against to tell us. Otherwise we have to assume the entry in .gitmodules is stale or otherwise invalid. Thus we pass the index of the repository into the workdir iterator, even if we do not want to compare against it. This follows what git does, which even for `git diff <tree>`, it will consider staged submodules as such.
* 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.