summaryrefslogtreecommitdiff
path: root/src/stash.c
Commit message (Collapse)AuthorAgeFilesLines
* git_diff_generated: abstract generated diffsEdward Thomson2016-05-261-0/+1
|
* Horrible fix for #3173.Arthur Schreiber2016-02-111-4/+4
|
* iterator: use an options struct instead of argsEdward Thomson2015-08-281-12/+17
|
* Fix #3094 - improve use of portable size_t/ssize_t format specifiers.Matthew Plough2015-07-121-1/+1
| | | | The header src/cc-compat.h defines portable format specifiers PRIuZ, PRIdZ, and PRIxZ. The original report highlighted the need to use these specifiers in examples/network/fetch.c. For this commit, I checked all C source and header files not in deps/ and transitioned to the appropriate format specifier where appropriate.
* stash: drop unused variableEdward Thomson2015-06-291-2/+1
|
* stash: stage new files when unstashing themEdward Thomson2015-06-251-0/+78
| | | | | Files that were new (staged additions) in the stash tree should be staged when unstashing, even when not applying the index.
* stash: don't allow apply with staged changesEdward Thomson2015-06-251-0/+26
|
* stash: save the workdir file when deleted in indexEdward Thomson2015-06-231-3/+26
| | | | | | | | | | | | | | When stashing the workdir tree, examine the index as well. Using a mechanism similar to `git_diff_tree_to_workdir_with_index` allows us to determine that a file was added in the index and subsequently modified in the working directory. Without examining the index, we would erroneously believe that this file was untracked and fail to include it in the working directory tree. Use a slightly modified `git_diff_tree_to_workdir_with_index` in order to avoid some of the behavior custom to `git diff`. In particular, be sure to include the working directory side of a file when it was deleted in the index.
* Write modified index in git_stash_apply()Pierre-Olivier Latour2015-06-211-0/+2
| | | | | Same as with git_stash_save(), there's no reason not to write the index to disk since it has been modified.
* Rename GIT_EMERGECONFLICT to GIT_ECONFLICTEdward Thomson2015-05-291-1/+1
| | | | | | | | | | 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.
* Fix a few leaksCarlos Martín Nieto2015-05-131-4/+8
| | | | | The interesting one is the notification macro, which was returning directly on a soft-abort instead of going through the cleanup.
* stash: propagate the error when writing a treeEdward Thomson2015-05-111-1/+1
|
* stash_apply: provide progress callbacksEdward Thomson2015-05-111-3/+23
|
* stash_apply: provide its own options structureEdward Thomson2015-05-111-28/+35
|
* stash apply: default to at least GIT_CHECKOUT_SAFEEdward Thomson2015-05-111-2/+3
|
* stash: return GIT_EMERGECONFLICT on merge conflictEdward Thomson2015-05-111-3/+1
|
* stash: refactor to use merge_iteratorsEdward Thomson2015-05-111-172/+93
|
* stash: ensure a reflog has entriesEdward Thomson2015-05-111-2/+2
|
* stash apply: check out a tree, not piecewiseEdward Thomson2015-05-111-32/+11
|
* stash: use git_commit_summary for a summaryEdward Thomson2015-05-111-12/+4
|
* Added git_stash_apply() and git_stash_pop() APIsPierre-Olivier Latour2015-05-111-0/+371
|
* Merge pull request #2913 from ethomson/stash_fixupEdward Thomson2015-03-031-2/+1
|\ | | | | stash: correctly stash wd modified/index deleted
| * stash: correctly stash wd modified/index deletedEdward Thomson2015-02-181-2/+1
| |
* | Remove the signature from ref-modifying functionsCarlos Martín Nieto2015-03-031-3/+2
|/ | | | | | | | | | The signature for the reflog is not something which changes dynamically. Almost all uses will be NULL, since we want for the repository's default identity to be used, making it noise. In order to allow for changing the identity, we instead provide git_repository_set_ident() and git_repository_ident() which allow a user to override the choice of signature.
* transaction: rename lock() to lock_ref()cmn/reference-transactionCarlos Martín Nieto2014-10-091-1/+1
| | | | | This leaves space for future expansion to locking other resources without having to change the API for references.
* stash: use a transaction to modify the reflogCarlos Martín Nieto2014-09-301-13/+17
| | | | | | | | | The stash is implemented as the refs/stash reference and its reflog. In order to modify the reflog, we need avoid races by making sure we're the only ones allowed to modify the reflog. We achieve this via the transactions API. Locking the reference gives us exclusive write access, letting us modify and write it without races.
* Recurse ignored directories when stashingJacques Germishuys2014-09-261-3/+5
|
* Several CppCat warnings fixedArkady Shapkin2014-09-031-1/+2
|
* Make stash and checkout ignore contained reposRussell Belfer2014-04-221-1/+2
| | | | | | | | | | | 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.
* git_checkout_opts -> git_checkout_optionsBen Straub2014-03-061-1/+1
|
* Remove ignored files from the working directory if they were stashedJacques Germishuys2014-03-041-2/+7
|
* refs: remove the _with_log differentiationCarlos Martín Nieto2014-01-151-2/+2
| | | | | | Any well-behaved program should write a descriptive message to the reflog whenever it updates a reference. Let's make this more prominent by removing the version without the reflog parameters.
* Merge pull request #1920 from libgit2/cmn/ref-with-logVicent Marti2013-12-181-15/+9
|\ | | | | Reference operations with log
| * refs: expose a way to ensure a ref has a logCarlos Martín Nieto2013-12-091-0/+3
| | | | | | | | | | | | Sometimes (e.g. stash) we want to make sure that a log will be written, even if it's not in one of the standard locations. Let's make that easier.
| * reflog: integrate into the ref writingCarlos Martín Nieto2013-11-231-15/+6
| | | | | | | | | | | | | | | | | | | | | | | | Whenever a reference is created or updated, we need to write to the reflog regardless of whether the user gave us a message, so we shouldn't leave that to the ref frontend, but integrate it into the backend. This also eliminates the race between ref update and writing to the reflog, as we protect the reflog with the ref lock. As an additional benefit, this reflog append on the backend happens by appending to the file instead of parsing and rewriting it.
* | One more rename/cleanup for callback err functionsRussell Belfer2013-12-111-1/+1
| |
* | Some callback error check style cleanupsRussell Belfer2013-12-111-6/+8
| | | | | | | | I find this easier to read...
* | Remove converting user error to GIT_EUSERRussell Belfer2013-12-111-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Further EUSER and error propagation fixesRussell Belfer2013-12-111-2/+2
|/ | | | | | | | | | | | | 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.
* Merge pull request #1802 from libgit2/cmn/reflog-backendBen Straub2013-10-281-5/+6
|\ | | | | Make reflog part of refdb
| * reflog: move the reflog implementation into refdb_fsCarlos Martín Nieto2013-10-021-5/+6
| | | | | | | | | | | | | | | | | | | | References and their logs are logically coupled, let's make it so in the code by moving the fs-based reflog implementation to live next to the fs-based refs one. As part of the change, make the function take names rather than references, as only the names are relevant when looking up and handling reflogs.
* | Diff API cleanupRussell Belfer2013-10-151-79/+54
| | | | | | | | | | | | | | | | This lays groundwork for separating formatting options from diff creation options. This groups the formatting flags separately from the diff list creation flags and reorders the options. This also tweaks some APIs to further separate code that uses patches from code that just looks at git_diffs.
* | Rename diff objects and split patch.hRussell Belfer2013-10-111-5/+5
|/ | | | | | 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.
* Never consider submodules for stashingJustin Spahr-Summers2013-09-271-2/+6
|
* No such thing as an orphan branchCarlos Martín Nieto2013-09-171-1/+1
| | | | | | | | | | | 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.
* Make the git_signature const in the stash API.Etienne Samson2013-07-091-5/+5
|
* Reorganize diff and add basic diff driverRussell Belfer2013-06-101-0/+1
| | | | | | | | | | | | | | | | | | 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.
* Clear error msg when we eat error silentlyRussell Belfer2013-05-011-2/+4
|
* immutable references and a pluggable ref databaseEdward Thomson2013-03-071-2/+4
|
* stash: Update the reference when dropping the topmost stashnulltoken2013-02-221-0/+6
|