summaryrefslogtreecommitdiff
path: root/src/stash.c
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* Vector improvements and their falloutPhilip Kelley2013-01-271-1/+1
|
* add an index_remove_bypath that removes conflicts, renamed add_from_workdir ↵Edward Thomson2013-01-121-1/+1
| | | | to match
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* Fix use of uninitialized variableRussell Belfer2013-01-041-3/+3
|
* Improve error propagation in stashRussell Belfer2013-01-041-109/+107
| | | | | | | | | | | | Stash was sometimes obscuring the actual error code, replacing it with a -1 when there was more descriptive value. This updates stash to preserve the original error code more reliably along with a variety of other error handling tweaks. I believe this is an improvement, but arguably, preserving the underlying error code may result in values that are harder to interpret by the caller who does not understand the internals. Discussion is welcome!
* Rework checkout internals (again)Russell Belfer2013-01-041-2/+1
| | | | | | | | | | | | | | | | 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.
* Fix diff constructor name order confusionRussell Belfer2012-12-171-3/+3
| | | | | | | | | | | | 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
* Remove GIT_SIGNATURE_VERSION and friendsBen Straub2012-12-031-2/+0
|
* Deploy GITERR_CHECK_VERSIONBen Straub2012-11-301-2/+1
|
* Deploy GIT_SIGNATURE_INITBen Straub2012-11-301-0/+4
|
* Deploy GIT_STATUS_OPTIONS_INITBen Straub2012-11-301-2/+1
|
* Deploy GIT_DIFF_OPTIONS_INITBen Straub2012-11-301-2/+2
|
* Deploy GIT_CHECKOUT_OPTS_INITBen Straub2012-11-301-3/+1
|
* API updates for stash.hBen Straub2012-11-271-1/+1
|
* Fix warnings on Win64 buildRussell Belfer2012-11-271-1/+1
|
* Update diff callback param orderRussell Belfer2012-11-271-5/+5
| | | | | | | | This makes the diff functions that take callbacks both take the payload parameter after the callback function pointers and pass the payload as the last argument to the callback function instead of the first. This should make them consistent with other callbacks across the API.
* Rename ref and reflog apis for consistencyBen Straub2012-11-271-4/+4
|
* reflog: make entry_byindex() and drop() git compliantnulltoken2012-11-171-2/+2
| | | | | Passing 0 as the index now retrieves the most recent entry instead of the oldest one.
* Add explicit git_index ptr to diff and checkoutRussell Belfer2012-11-141-2/+2
| | | | | | | | A number of diff APIs and the `git_checkout_index` API take a `git_repository` object an operate on the index. This updates them to take a `git_index` pointer explicitly and only fall back on the `git_repository` index if the index input is NULL. This makes it easier to operate on a temporary index.
* Fix diff API to better parameter orderRussell Belfer2012-11-141-3/+4
| | | | | The diff API is not in the parameter order one would expect from other libgit2 APIs. This fixes that.
* Rework checkout with new strategy optionsRussell Belfer2012-11-091-2/+2
| | | | | | | | | | | | | | | | | | This is a major reworking of checkout strategy options. The checkout code is now sensitive to the contents of the HEAD tree and the new options allow you to update the working tree so that it will match the index content only when it previously matched the contents of the HEAD. This allows you to, for example, to distinguish between removing files that are in the HEAD but not in the index, vs just removing all untracked files. Because of various corner cases that arise, etc., this required some additional capabilities in rmdir and other utility functions. This includes the beginnings of an implementation of code to read a partial tree into the index based on a pathspec, but that is not enabled because of the possibility of creating conflicting index entries.
* index: Fix testsVicent Marti2012-11-011-1/+1
|
* index refactoringEdward Thomson2012-10-291-4/+4
|
* stash: add git_stash_drop()nulltoken2012-10-261-0/+40
|
* stash: add git_stash_foreach()nulltoken2012-10-261-0/+42
|
* stash: add git_stash_save()nulltoken2012-10-261-0/+577