summaryrefslogtreecommitdiff
path: root/src/refs.c
Commit message (Collapse)AuthorAgeFilesLines
* Const correctness!Jacques Germishuys2014-04-031-5/+7
|
* branch: constness fixesCarlos Martín Nieto2014-03-171-1/+1
|
* refs: move current_id before the reflog parametersCarlos Martín Nieto2014-02-101-8/+8
| | | | | Keep the reflog parameters as the last two, as they're the optional parameters.
* Merge pull request #2099 from libgit2/bs/more-reflog-stuffRussell Belfer2014-02-071-1/+3
|\ | | | | More reflogness
| * Add reset tests for reflogBen Straub2014-02-031-1/+3
| |
* | refs: add an unconditional deleteCarlos Martín Nieto2014-02-051-0/+11
| | | | | | | | | | Add it under the git_reference_remove() name, letting the user pass the repo and name, analogous to unconditional setting/creation.
* | refs: check the ref's old value when deletingCarlos Martín Nieto2014-02-051-1/+9
| | | | | | | | Recognize when the reference has changed since we loaded it.
* | refs: placeholder conditional deleteCarlos Martín Nieto2014-02-051-1/+1
| | | | | | | | We don't actually pass the old value yet.
* | refs: bring conditional symbolic updates to the frontendCarlos Martín Nieto2014-02-051-5/+18
| | | | | | | | Bring the race detection goodness to symbolic references as well.
* | refdb: add conditional symbolic updatesCarlos Martín Nieto2014-02-051-4/+5
| | | | | | | | | | Add a parameter to the backend to allow checking for the old symbolic target.
* | refs: changes from feedbackCarlos Martín Nieto2014-02-051-27/+17
| | | | | | | | | | | | Change the name to _matching() intead of _if(), and force _set_target() to be a conditional update. If the user doesn't care about the old value, they should use git_reference_create().
* | refs: conditional ref updatesCarlos Martín Nieto2014-02-051-10/+37
|/ | | | Allow updating references if the old value matches the given one.
* Add `git_reference_is_note`.Arthur Schreiber2014-02-021-0/+11
|
* Enhance testing of signature parametersBen Straub2014-01-301-1/+2
|
* Ensure renaming a reference updates the reflogBen Straub2014-01-301-15/+7
|
* Add reflog params to set-head callsBen Straub2014-01-301-1/+1
|
* refs: remove the _with_log differentiationCarlos Martín Nieto2014-01-151-59/+53
| | | | | | 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.
* refs: handle NULL pointers passed to git_reference_iterator_free()Brodie Rao2014-01-121-0/+3
| | | | Signed-off-by: Brodie Rao <brodie@sf.io>
* Allow the log message to be NULL.Arthur Schreiber2014-01-021-2/+2
|
* Add missing `git_reference_symbolic_create_with_log`.Arthur Schreiber2014-01-021-0/+15
| | | | It's exported in the headers, but the implementation was missing.
* Merge pull request #1920 from libgit2/cmn/ref-with-logVicent Marti2013-12-181-56/+157
|\ | | | | Reference operations with log
| * refs: expose has_log() on the backendCarlos Martín Nieto2013-12-091-12/+7
| | | | | | | | | | | | The frontend used to look at the file directly, but that's obviously not the right thing to do. Expose it on the backend and use that function instead.
| * refs: expose a way to ensure a ref has a logCarlos Martín Nieto2013-12-091-0/+13
| | | | | | | | | | | | 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-73/+55
| | | | | | | | | | | | | | | | | | | | | | | | 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.
| * refdb: add a `message` parameter for appending to the logCarlos Martín Nieto2013-11-231-2/+2
| | | | | | | | This is as yet unused.
| * refs: adjust to the new reflog APICarlos Martín Nieto2013-11-231-15/+3
| |
| * refs: Introduce git_reference_symbolic_set_target_with_log()nulltoken2013-11-231-5/+32
| |
| * refs: Introduce git_reference_set_target_with_log()nulltoken2013-11-231-4/+32
| |
| * refs: Introduce git_reference_symbolic_create_with_log()nulltoken2013-11-231-0/+15
| |
| * refs: Introduce git_reference_create_with_log()nulltoken2013-11-231-3/+55
| |
| * refs: Centralize reference creation logicnulltoken2013-11-231-25/+26
| |
* | One more rename/cleanup for callback err functionsRussell Belfer2013-12-111-3/+3
| |
* | Further callback error check style fixesRussell Belfer2013-12-111-9/+18
| | | | | | | | | | Okay, I've decided I like the readability of this style much better so I used it everywhere.
* | Remove converting user error to GIT_EUSERRussell Belfer2013-12-111-21/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-15/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Improve GIT_EUSER handlingRussell Belfer2013-12-111-1/+1
|/ | | | | | | | | | | 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.
* iconv: Do not fake an API when iconv is not availableVicent Marti2013-11-011-0/+7
|
* Merge pull request #1802 from libgit2/cmn/reflog-backendBen Straub2013-10-281-1/+1
|\ | | | | Make reflog part of refdb
| * reflog: move the reflog implementation into refdb_fsCarlos Martín Nieto2013-10-021-1/+1
| | | | | | | | | | | | | | | | | | | | 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.
* | After iconv init reset ref normalize errorRussell Belfer2013-10-091-0/+1
| | | | | | | | | | | | The iconv init was accidentally clearing the default error state during reference normalization. This resets so that normalization errors will be detected correctly.
* | Make reference lookups apply precomposeunicodeRussell Belfer2013-10-081-23/+44
|/ | | | | | | | | | | | | | | | | | | | | Before these changes, looking up a reference would return the same precomposed or decomposed form of the reference name that was used to look it up, so on MacOS which ignores the difference between the two, a single reference could be looked up either way and git_reference_name would return the form of the name that was used to look it up! This change makes lookup always return the precomposed name if core.precomposeunicode is set regardless of which version was used to look it up. The reference iterator was already returning the precomposed form from earlier work. This also updates the CMakeLists.txt rules for enabling iconv usage because the clar tests for this code were actually not being activated properly with the old version. Finally, this moves git_repository_reset_filesystem from include/ git2/repository.h to include/git2/sys/repository.h since it is not really a function that normal library users should have to think about very often.
* Merge pull request #1805 from libgit2/threading-packed-loadVicent Martí2013-08-281-0/+11
|\ | | | | Thread safety for the refdb_fs
| * Add internal ref set_name fn instead of reallocRussell Belfer2013-08-211-0/+11
| | | | | | | | | | | | | | | | The refdb_fs implementation calls realloc directly on a reference object when it wants to rename it. It is not a public object, so this doesn't mess with the immutability of references, but it does assume certain constraints on the reference representation. This commit wraps that assumption in an isolated API to isolate it.
* | refs: add git_reference_is_tagNikolai Vladimirov2013-08-261-0/+11
|/
* 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.
* Merge pull request #1624 from libgit2/vmg/full-ref-iteratorVicent Martí2013-06-031-203/+95
|\ | | | | Breaking RefDB changes
| * RefcountingVicent Marti2013-05-301-0/+3
| |
| * ...Aaaand this worksVicent Marti2013-05-301-170/+22
| |
| * What are the chances, reallyVicent Marti2013-05-291-44/+81
| |
| * Liike thisVicent Marti2013-05-281-1/+1
| |