summaryrefslogtreecommitdiff
path: root/src/push.c
Commit message (Collapse)AuthorAgeFilesLines
* git_error: use new names in internal APIs and usageEdward Thomson2019-01-221-17/+17
| | | | | Move to the `git_error` name in the internal API for error-related functions.
* object_type: use new enumeration namesethomson/index_fixesEdward Thomson2018-12-011-6/+6
| | | | Use the new object_type enumeration names within the codebase.
* remote: store the connection data in a private structEtienne Samson2018-09-071-2/+3
| | | | | | | | This makes it easier to pass connection-related options around (proxy & custom headers for now). This fixes a bug in git_push_finish, which didn't reuse the provided proxy if the connection closed between the call to `git_remote_push` and the finish step.
* refspec: rename `git_refspec__free` to `git_refspec__dispose`Patrick Steinhardt2018-06-291-1/+1
| | | | | | | | | Since commit 630a67366 (refspec: add public parsing api, 2018-02-07), we now have two functions `git_refspec_free` and `git_refspec__free`. The difference is that the first one will free the structure itself, while the second one will only free the structure's contents. Use our new `dispose` naming pattern for the latter function to help avoid confusion.
* Convert usage of `git_buf_free` to new `git_buf_dispose`Patrick Steinhardt2018-06-101-1/+1
|
* Merge pull request #4028 from chescock/improve-local-fetchEdward Thomson2017-12-301-169/+2
|\ | | | | Transfer fewer objects on push and local fetch
| * Use git_packbuilder_insert_walk in queue_objects.Chris Hescock2016-12-201-169/+2
| |
* | Clear the remote_ref_name buffer in git_push_update_tips()Slava Karpenko2017-09-111-0/+3
| | | | | | | | | | | | If fetch_spec was a non-pattern, and it is not the first iteration of push_status vector, then git_refspec_transform would result in the new value appended via git_buf_puts to the previous iteration value. Forcibly clearing the buffer on each iteration to prevent this behavior.
* | Make sure to always include "common.h" firstPatrick Steinhardt2017-07-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Next to including several files, our "common.h" header also declares various macros which are then used throughout the project. As such, we have to make sure to always include this file first in all implementation files. Otherwise, we might encounter problems or even silent behavioural differences due to macros or defines not being defined as they should be. So in fact, our header and implementation files should make sure to always include "common.h" first. This commit does so by establishing a common include pattern. Header files inside of "src" will now always include "common.h" as its first other file, separated by a newline from all the other includes to make it stand out as special. There are two cases for the implementation files. If they do have a matching header file, they will always include this one first, leading to "common.h" being transitively included as first file. If they do not have a matching header file, they instead include "common.h" as first file themselves. This fixes the outlined problems and will become our standard practice for header and source files inside of the "src/" from now on.
* | giterr_set: consistent error messagesEdward Thomson2016-12-291-6/+6
|/ | | | | | | | Error messages should be sentence fragments, and therefore: 1. Should not begin with a capital letter, 2. Should not conclude with punctuation, and 3. Should not end a sentence and begin a new one
* proxy: ask the user for credentials if necessaryCarlos Martín Nieto2016-04-191-1/+1
|
* tree: re-use the id and filename in the odb objectCarlos Martín Nieto2016-03-201-6/+6
| | | | | Instead of copying over the data into the individual entries, point to the originals, which are already in a format we can use.
* Tell the git_transport about the custom_headersMatt Burke2015-09-081-1/+2
|
* push: fix the update constructorcmn/push-notify-deletedCarlos Martín Nieto2015-05-141-3/+4
| | | | | There was a copypasta error and the source and destination IDs were reversed.
* push: free the update listCarlos Martín Nieto2015-05-131-0/+8
|
* Remove the callbacks struct from the remoteCarlos Martín Nieto2015-05-131-15/+14
| | | | | | | | | | | | | | Having the setting be different from calling its actions was not a great idea and made for the sake of the wrong convenience. Instead of that, accept either fetch options, push options or the callbacks when dealing with the remote. The fetch options are currently only the callbacks, but more options will be moved from setters and getters on the remote to the options. This does mean passing the same struct along the different functions but the typical use-case will only call git_remote_fetch() or git_remote_push() and so won't notice much difference.
* push: remove own copy of callbacksCarlos Martín Nieto2015-05-131-30/+6
| | | | | | | | | The push object knows which remote it's associated with, and therefore does not need to keep its own copy of the callbacks stored in the remote. Remove the copy and simply access the callbacks struct within the remote.
* push: report the update plan to the callercmn/negotiation-notifyCarlos Martín Nieto2015-04-191-4/+43
| | | | | | | | | It can be useful for the caller to know which update commands will be sent to the server before the packfile is pushed up. git does this via the pre-push hook. We don't have hooks, but as it adds introspection into what is happening, we can add a callback which performs the same function.
* Fixed update_tips callback called for failed pushed referencesPierre-Olivier Latour2015-03-111-13/+14
| | | | | | The current implementation does not set 'fire_callback' back to 0 for failed updates so the callback still fires. Instead of adding yet another condition check to set 'fire_callback' to 0 if needed, considering this function should be a no-op for failed updates anyway, the best fix is to simplify its logic to check upfront if the update is a failed one.
* push: remove reflog message overrideCarlos Martín Nieto2015-03-031-4/+2
| | | | We always use "update by push".
* Remove the signature from ref-modifying functionsCarlos Martín Nieto2015-03-031-2/+1
| | | | | | | | | | 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.
* push: fold unpack_ok() into finish()Carlos Martín Nieto2014-12-101-5/+5
| | | | | The push cannot be successful if we sent a bad packfile. We should return an error in that case instead of storing it elsewhere.
* Merge pull request #2713 from libgit2/jamill/push_fetch_firstVicent Marti2014-11-201-1/+2
|\ | | | | Update message for error during push
| * Update message for error during pushjamill/push_fetch_firstJameson Miller2014-11-171-1/+2
| | | | | | | | | | | | When attempting to update a reference on a remote during push, and the reference on the remote refers to a commit that does not exist locally, then we should report a more clear error message.
* | push: use the common refspec parsercmn/push-refspec-refactorCarlos Martín Nieto2014-11-091-48/+19
|/ | | | | | | | | | | There is one well-known and well-tested parser which we should use, instead of implementing parsing a second time. The common parser is also augmented to copy the LHS into the RHS if the latter is empty. The expressions test had to change a bit, as we now catch a bad RHS of a refspec locally.
* Make init_options fns use unsigned ints and macroRussell Belfer2014-05-021-9/+4
| | | | | Use an unsigned int for the version and add a helper macro so the code is simplified (and so the error message is a common string).
* Fire update_tips callback also for pushes.Jacques Germishuys2014-04-211-17/+29
|
* It is safe to free() a NULL pointerJacques Germishuys2014-04-211-3/+1
|
* Const correctness!Jacques Germishuys2014-04-031-1/+1
|
* Added function-based initializers for every options struct.Matthew Bowen2014-03-051-0/+12
| | | | The basic structure of each function is courtesy of arrbee.
* Add reflog parameters to git_push_update_tipsBen Straub2014-02-041-2/+7
|
* refspec: move to git_buf for outputting stringsCarlos Martín Nieto2014-01-271-1/+1
|
* refs: remove the _with_log differentiationCarlos Martín Nieto2014-01-151-1/+1
| | | | | | 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.
* Cleanups, renames, and leak fixesRussell Belfer2013-12-121-1/+1
| | | | | | | | | This renames git_vector_free_all to the better git_vector_free_deep and also contains a couple of memory leak fixes based on valgrind checks. The fixes are specifically: failure to free global dir path variables when not compiled with threading on and failure to free filters from the filter registry that had not be initialized fully.
* One more rename/cleanup for callback err functionsRussell Belfer2013-12-111-1/+1
|
* Some callback error check style cleanupsRussell Belfer2013-12-111-2/+3
| | | | I find this easier to read...
* Remove converting user error to GIT_EUSERRussell Belfer2013-12-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add git_vector_free_allRussell Belfer2013-12-111-4/+1
| | | | | | There are a lot of places that we call git__free on each item in a vector and then call git_vector_free on the vector itself. This just wraps that up into one convenient helper function.
* Further EUSER and error propagation fixesRussell Belfer2013-12-111-1/+1
| | | | | | | | | | | | | 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.
* Fix warningsRussell Belfer2013-11-131-2/+2
|
* Fix warningsLinquize2013-11-121-1/+1
|
* remote: make _ls return the list directlyCarlos Martín Nieto2013-11-111-7/+13
| | | | | | | | | | | The callback-based method of listing remote references dates back to the beginning of the network code's lifetime, when we didn't know any better. We need to keep the list around for update_tips() after disconnect() so let's make use of this to simply give the user a pointer to the array so they can write straightforward code instead of having to go through a callback.
* Support cancellation in push operationJameson Miller2013-10-021-3/+1
| | | | | | | | | | | | | | | | This commit adds cancellation for the push operation. This work consists of: 1) Support cancellation during push operation - During object counting phase - During network transfer phase - Propagate GIT_EUSER error code out to caller 2) Improve cancellation support during fetch - Handle cancellation request during network transfer phase - Clear error string when cancelled during indexing 3) Fix error handling in git_smart__download_pack Cancellation during push is still only handled in the pack building and network transfer stages of push (and not during packbuilding).
* Initial Implementation of progress reports during pushJameson Miller2013-09-301-0/+23
| | | | | | | | | | | | | | | | | | | | | | This adds the basics of progress reporting during push. While progress for all aspects of a push operation are not reported with this change, it lays the foundation to add these later. Push progress reporting can be improved in the future - and consumers of the API should just get more accurate information at that point. The main areas where this is lacking are: 1) packbuilding progress: does not report progress during deltafication, as this involves coordinating progress from multiple threads. 2) network progress: reports progress as objects and bytes are going to be written to the subtransport (instead of as client gets confirmation that they have been received by the server) and leaves out some of the bytes that are transfered as part of the push protocol. Basically, this reports the pack bytes that are written to the subtransport. It does not report the bytes sent on the wire that are received by the server. This should be a good estimate of progress (and an improvement over no progress).
* push: handle tag chains correctlyCarlos Martín Nieto2013-08-161-11/+32
| | | | | | | | | When dealing with a chain of tags, we need to enqueue each of them individually, which means we can't use `git_tag_peel` as that jumps over the intermediate tags. Do the peeling manually so we can look at each object and take the appropriate action.
* Fix broken build when MSVC SDL checks is enabledLinquize2013-05-111-1/+1
|
* Report some errors returnable by pushRussell Belfer2013-05-011-6/+8
|
* Make git_oid_cmp public and add git_oid__cmpRussell Belfer2013-04-291-1/+1
|
* remote: handle multiple refspecsCarlos Martín Nieto2013-04-201-2/+3
| | | | | | | | | | | | | A remote can have a multitude of refspecs. Up to now our git_remote's have supported a single one for each fetch and push out of simplicity to get something working. Let the remotes and internal code know about multiple remotes and get the tests passing with them. Instead of setting a refspec, the external users can clear all and add refspecs. This should be enough for most uses, though we're still missing a querying function.
* Merge remote-tracking branch 'ben/unified-revparse' into developmentVicent Marti2013-04-151-11/+9
|\