summaryrefslogtreecommitdiff
path: root/src/refs.c
Commit message (Collapse)AuthorAgeFilesLines
* Fixed Xcode 6.1 build warningsPierre-Olivier Latour2015-06-151-1/+1
|
* squash some leaksEdward Thomson2015-03-241-5/+3
|
* Plug a few leaksCarlos Martín Nieto2015-03-041-4/+6
|
* repository: remove log message override for switching the active branchCarlos Martín Nieto2015-03-031-4/+7
| | | | | | We want to use the "checkout: moving from ..." message in order to let git know when a change of branch has happened. Make the convenience functions for this goal write this message.
* Remove the signature from ref-modifying functionsCarlos Martín Nieto2015-03-031-68/+85
| | | | | | | | | | 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.
* 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.
* Make our overflow check look more like gcc/clang'sEdward Thomson2015-02-131-12/+10
| | | | | | | | | Make our overflow checking look more like gcc and clang's, so that we can substitute it out with the compiler instrinsics on platforms that support it. This means dropping the ability to pass `NULL` as an out parameter. As a result, the macros also get updated to reflect this as well.
* overflow checking: don't make callers set oomEdward Thomson2015-02-121-3/+1
| | | | | | Have the ALLOC_OVERFLOW testing macros also simply set_oom in the case where a computation would overflow, so that callers don't need to.
* allocations: test for overflow of requested sizeEdward Thomson2015-02-121-5/+13
| | | | | Introduce some helper macros to test integer overflow from arithmetic and set error message appropriately.
* git_rebase_commit: write HEAD's reflog appropriatelyEdward Thomson2014-10-261-0/+35
|
* Introduce reference transactionsCarlos Martín Nieto2014-09-301-3/+3
| | | | | | | | | A transaction allows you to lock multiple references and set up changes for them before applying the changes all at once (or as close as the backend supports). This can be used for replication purposes, or for making sure some operations run when the reference is locked and thus cannot be changed.
* Refs: Introduce `git_refname_t`.Arthur Schreiber2014-05-301-13/+10
|
* Refs: Fix some issue when core.precomposeunicode = true.Arthur Schreiber2014-05-301-24/+9
| | | | | | | | | | | This fixes two issues I found when core.precomposeunicode is enabled: * When creating a reference with a NFD string, the returned git_reference would return this NFD string as the reference’s name. But when looking up the reference later, the name would then be returned as NFC string. * Renaming a reference would not honor the core.precomposeunicode and apply no normalization to the new reference name.
* 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
|