summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* send-pack: unify error messages for unsupported capabilitiessb/atomic-pushRalf Thielow2015-04-021-1/+1
| | | | | | | | | | If --signed is not supported, the error message names the remote "receiving end". If --atomic is not supported, the error message names the remote "server". Unify the naming to "receiving end" as we're in the context of "push". Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Document receive.advertiseatomicStefan Beller2015-01-141-0/+5
| | | | | | | | | This was missing in 1b70fe5d3054 (2015-01-07, receive-pack.c: negotiate atomic push support) as I squashed the option in very late in the patch series. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* t5543-atomic-push.sh: add basic tests for atomic pushesStefan Beller2015-01-071-0/+194
| | | | | | | | | | | This adds tests for the atomic push option. The first four tests check if the atomic option works in good conditions and the last three patches check if the atomic option prevents any change to be pushed if just one ref cannot be updated. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* push.c: add an --atomic argumentRonnie Sahlberg2015-01-074-1/+13
| | | | | | | | | Add a command line argument to the git push command to request atomic pushes. Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* send-pack.c: add --atomic command line argumentRonnie Sahlberg2015-01-076-6/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds support to send-pack to negotiate and use atomic pushes iff the server supports it. Atomic pushes are activated by a new command line flag --atomic. In order to do this we also need to change the semantics for send_pack() slightly. The existing send_pack() function actually doesn't send all the refs back to the server when multiple refs are involved, for example when using --all. Several of the failure modes for pushes can already be detected locally in the send_pack client based on the information from the initial server side list of all the refs as generated by receive-pack. Any such refs that we thus know would fail to push are thus pruned from the list of refs we send to the server to update. For atomic pushes, we have to deal thus with both failures that are detected locally as well as failures that are reported back from the server. In order to do so we treat all local failures as push failures too. We introduce a new status code REF_STATUS_ATOMIC_PUSH_FAILED so we can flag all refs that we would normally have tried to push to the server but we did not due to local failures. This is to improve the error message back to the end user to flag that "these refs failed to update since the atomic push operation failed." Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* send-pack: rename ref_update_to_be_sent to check_to_send_updateStefan Beller2015-01-071-7/+11
| | | | | | | | | | | This renames ref_update_to_be_sent to check_to_send_update and inverts the meaning of the return value. Having the return value inverted we can have different values for the error codes. This is useful in a later patch when we want to know if we hit the CHECK_REF_STATUS_REJECTED case. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* receive-pack.c: negotiate atomic push supportRonnie Sahlberg2015-01-072-2/+22
| | | | | | | | | | | | | | This adds the atomic protocol option to allow receive-pack to inform the client that it has atomic push capability. This commit makes the functionality introduced in the previous commits go live for the serving side. The changes in documentation reflect the protocol capabilities of the server. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* receive-pack.c: add execute_commands_atomic functionStefan Beller2015-01-071-1/+46
| | | | | | | | | | | | | | | | | This introduces the new function execute_commands_atomic which will use one atomic transaction for all updates. The default behavior is still the old non atomic way, one ref at a time. This is to cause as little disruption as possible to existing clients. It is unknown if there are client scripts that depend on the old non-atomic behavior so we make it opt-in for now. A later patch will add the possibility to actually use the functionality added by this patch. For now use_atomic is always 0. Inspired-by: Ronnie Sahlberg <sahlberg@google.com> Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* receive-pack.c: move transaction handling in a central placeStefan Beller2015-01-071-14/+37
| | | | | | | | | | | | | | This moves all code related to transactions into the execute_commands_non_atomic function. This includes beginning and committing the transaction as well as dealing with the errors which may occur during the begin and commit phase of a transaction. No functional changes intended. Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* receive-pack.c: move iterating over all commands outside execute_commandsStefan Beller2015-01-071-6/+13
| | | | | | | | | This commit allows us in a later patch to easily distinguish between the non atomic way to update the received refs and the atomic way which is introduced in a later patch. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* receive-pack.c: die instead of error in case of possible future bugStefan Beller2015-01-071-3/+1
| | | | | | | | | | | | | | | Discussion on the previous patch revealed we rather want to err on the safe side. To do so we need to stop receive-pack in case of the possible future bug when connectivity is not checked on a shallow push. Also while touching that code we considered that removing the reported refs may be harmful in some situations. Sound the message more like a "This Cannot Happen, Please Investigate!" instead of giving advice to remove refs. Suggested-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* receive-pack.c: shorten the execute_commands loop over all commandsStefan Beller2015-01-071-16/+27
| | | | | | | | | | | | | | | | | | Make the main "execute_commands" loop in receive-pack easier to read by splitting out some steps into helper functions. The new helper 'should_process_cmd' checks if a ref update is unnecessary, whether due to an error having occurred or for another reason. The helper 'warn_if_skipped_connectivity_check' warns if we have forgotten to run a connectivity check on a ref which is shallow for the client which would be a bug. This will help us to duplicate less code in a later patch when we make a second copy of the "execute_commands" loop. No functional change intended. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* refs.c: let fprintf handle the formattingmh/reflog-expireStefan Beller2014-12-221-5/+2
| | | | | | | | | Instead of calculating whether to put a plus or minus sign, offload the responsibilty to the fprintf function. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* refs.c: don't expose the internal struct ref_lock in the header fileStefan Beller2014-12-222-9/+9
| | | | | | | | | Now the struct ref_lock is used completely internally, so let's remove it from the header file. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* lock_any_ref_for_update(): inline functionMichael Haggerty2014-12-222-16/+2
| | | | | | | | Inline the function at its one remaining caller (which is within refs.c) and remove it. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* refs.c: remove unlock_ref/close_ref/commit_ref from the refs apiRonnie Sahlberg2014-12-222-21/+12
| | | | | | | | | | unlock|close|commit_ref can be made static since there are no more external callers. Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* reflog_expire(): new function in the reference APIMichael Haggerty2014-12-223-133/+190
| | | | | | | | | | | | | | Move expire_reflog() into refs.c and rename it to reflog_expire(). Turn the three policy functions into function pointers that are passed into reflog_expire(). Add function prototypes and documentation to refs.h. [jc: squashed in $gmane/261582, drop "extern" in function definition] Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Stefan Beller <sbeller@google.com> Tweaked-by: Ramsay Jones Signed-off-by: Junio C Hamano <gitster@pobox.com>
* expire_reflog(): treat the policy callback data as opaqueMichael Haggerty2014-12-121-36/+36
| | | | | | | | | | | | | | | | | | | | | Now that expire_reflog() doesn't actually look in the expire_reflog_policy_cb data structure, we can make it opaque: * Change the callers of expire_reflog() to pass it a pointer to an entire "struct expire_reflog_policy_cb" rather than a pointer to a "struct cmd_reflog_expire_cb". * Change expire_reflog() to accept the argument as a "void *" and simply pass it through to the policy functions. * Change the policy functions, reflog_expiry_prepare(), reflog_expiry_cleanup(), and should_expire_reflog_ent(), to accept "void *cb_data" arguments and cast them back to "struct expire_reflog_policy_cb" internally. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Move newlog and last_kept_sha1 to "struct expire_reflog_cb"Michael Haggerty2014-12-121-10/+10
| | | | | | | | These members are not needed by the policy functions. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* expire_reflog(): move rewrite to flags argumentMichael Haggerty2014-12-121-5/+5
| | | | | | | | | The policy objects don't care about "--rewrite". So move it to expire_reflog()'s flags parameter. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* expire_reflog(): move verbose to flags argumentMichael Haggerty2014-12-121-8/+8
| | | | | | | | | The policy objects don't care about "--verbose". So move it to expire_reflog()'s flags parameter. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* expire_reflog(): pass flags through to expire_reflog_ent()Michael Haggerty2014-12-121-0/+2
| | | | | | | | | | Add a flags field to "struct expire_reflog_cb", and pass the flags argument through to expire_reflog_ent(). In a moment we will start using it to pass through flags that expire_reflog_ent() needs. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* struct expire_reflog_cb: a new callback data typeMichael Haggerty2014-12-121-17/+26
| | | | | | | | | | | | | Add a new data type, "struct expire_reflog_cb", for holding the data that expire_reflog() passes to expire_reflog_ent() via for_each_reflog_ent(). For now it only holds a pointer to a "struct expire_reflog_policy_cb", which still contains all of the actual data. In future commits we will move some fields from the latter to the former. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Rename expire_reflog_cb to expire_reflog_policy_cbMichael Haggerty2014-12-121-9/+10
| | | | | | | | | | | | | This is the first step towards separating the data needed by the policy code from the data needed by the reflog expiration machinery. (In a moment we will add a *new* "struct expire_reflog_cb" for the use of expire_reflog() itself, then move fields selectively from expire_reflog_policy_cb to expire_reflog_cb.) Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* expire_reflog(): move updateref to flags argumentMichael Haggerty2014-12-121-6/+6
| | | | | | | | | The policy objects don't care about "--updateref". So move it to expire_reflog()'s flags parameter. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* expire_reflog(): move dry_run to flags argumentMichael Haggerty2014-12-121-5/+8
| | | | | | | | | The policy objects don't care about "--dry-run". So move it to expire_reflog()'s flags parameter. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* expire_reflog(): add a "flags" argumentMichael Haggerty2014-12-121-4/+6
| | | | | | | | | | | | We want to separate the options relevant to the expiry machinery from the options affecting the expiration policy. So add a "flags" argument to expire_reflog() to hold the former. The argument doesn't yet do anything. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* expire_reflog(): extract two policy-related functionsMichael Haggerty2014-12-121-42/+52
| | | | | | | | | | | | | | | Extract two functions, reflog_expiry_prepare() and reflog_expiry_cleanup(), from expire_reflog(). This is a further step towards separating the code for deciding on expiration policy from the code that manages the physical deletion of reflog entries. This change requires a couple of local variables from expire_reflog() to be turned into fields of "struct expire_reflog_cb". More reorganization of the callback data will follow in later commits. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Extract function should_expire_reflog_ent()Michael Haggerty2014-12-121-28/+42
| | | | | | | | | | | | Extract from expire_reflog_ent() a function that is solely responsible for deciding whether a reflog entry should be expired. By separating this "business logic" from the mechanics of actually expiring entries, we are working towards the goal of encapsulating reflog expiry within the refs API, with policy decided by a callback function passed to it by its caller. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* expire_reflog(): use a lock_file for rewriting the reflog fileMichael Haggerty2014-12-121-19/+41
| | | | | | | | | | | | | | | We don't actually need the locking functionality, because we already hold the lock on the reference itself, which is how the reflog file is locked. But the lock_file code can do some of the bookkeeping for us, and it is more careful than the old code here was. For example: * It correctly handles the case that the reflog lock file already exists for some reason or cannot be opened. * It correctly cleans up the lockfile if the program dies. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* expire_reflog(): return early if the reference has no reflogMichael Haggerty2014-12-121-3/+5
| | | | | | | | | | | There is very little cleanup needed if the reference has no reflog. If we move the initialization of log_file down a bit, there's even less. So instead of jumping to the cleanup code at the end of the function, just do the cleanup and return inline. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* expire_reflog(): rename "ref" parameter to "refname"Michael Haggerty2014-12-121-8/+8
| | | | | | | | This is our usual convention. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* expire_reflog(): it's not an each_ref_fn anymoreMichael Haggerty2014-12-121-5/+5
| | | | | | | | | | | | | | | | Prior to v1.5.4~14, expire_reflog() had to be an each_ref_fn because it was passed to for_each_reflog(). Since then, there has been no reason for it to implement the each_ref_fn interface. So... * Remove the "unused" parameter (which took the place of "flags", but was really unused). * Declare the last parameter to be (struct cmd_reflog_expire_cb *) rather than (void *). Helped-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* refs.c: add a function to append a reflog entry to a fdRonnie Sahlberg2014-12-121-18/+30
| | | | | | | | | | | | | | | Break out the code to create the string and writing it to the file descriptor from log_ref_write and add it into a dedicated function log_ref_write_fd. It is a nice unit of work. For now this is only used from log_ref_write, but in the future it might have other callers. Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Stefan Beller <sbeller@google.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* refs.c: make ref_transaction_delete a wrapper for ref_transaction_updateRonnie Sahlberg2014-12-042-21/+3
| | | | | | | | | Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Stefan Beller <sbeller@google.com> Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* refs.c: make ref_transaction_create a wrapper for ref_transaction_updateRonnie Sahlberg2014-12-041-25/+2
| | | | | | | | | | | | | The ref_transaction_update function can already be used to create refs by passing null_sha1 as the old_sha1 parameter. Simplify by replacing transaction_create with a thin wrapper. Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Stefan Beller <sbeller@google.com> Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Git 2.2v2.2.0Junio C Hamano2014-11-262-1/+6
| | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* RelNotes: spelling & grammar tweaksMarc Branchaud2014-11-261-51/+52
| | | | | Signed-off-by: Marc Branchaud <marcnarc@xiplink.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Git 2.2.0-rc3v2.2.0-rc3Junio C Hamano2014-11-212-14/+15
| | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* l10n: remove a superfluous translation for push.cJiang Xin2014-11-206-30/+6
| | | | | | | | | | Ralf reported that '--recurse-submodules' option in push.c should not be translated [1]. Before his commit is merged, remove superfluous translations for push.c. [1] http://www.spinics.net/lists/git/msg241964.html Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
* l10n: de.po: translate 2 messagesRalf Thielow2014-11-201-3/+1
| | | | Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
* l10n: de.po: translate 2 new messagesRalf Thielow2014-11-201-2/+2
| | | | | Signed-off-by: Phillip Sz <phillip.szelat@gmail.com> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
* l10n: batch updates for one trivial changeJiang Xin2014-11-207-519/+554
| | | | | | | | In order to catch up with the release of Git 2.2.0 final, make a batch l10n update for the new l10n change brought by commit d52adf1 (trailer: display a trailer without its trailing newline). Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
* l10n: git.pot: v2.2.0 round 2 (1 updated)Jiang Xin2014-11-201-24/+24
| | | | | | | Generate po/git.pot from v2.2.0-rc2-23-gca0107e for git v2.2.0 l10n round 2. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
* Merge branch 'sv/submitting-final-patch'Junio C Hamano2014-11-191-1/+1
|\ | | | | | | | | * sv/submitting-final-patch: SubmittingPatches: final submission is To: maintainer and CC: list
| * SubmittingPatches: final submission is To: maintainer and CC: listsv/submitting-final-patchSlavomir Vlcek2014-11-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In an earlier part there is: "re-send it with "To:" set to the maintainer [*1*] and "cc:" the list [*2*]" for the final submission, but later we see "Send it to the list and cc the maintainer." Fix the later one to match the previous. Signed-off-by: Slavomir Vlcek <svlc@inventati.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'sn/tutorial-status-output-example'Junio C Hamano2014-11-192-19/+21
|\ \ | | | | | | | | | | | | * sn/tutorial-status-output-example: gittutorial: fix output of 'git status'
| * | gittutorial: fix output of 'git status'sn/tutorial-status-output-exampleStefan Naewe2014-11-132-19/+21
| | | | | | | | | | | | | | | | | | | | | 'git status' doesn't output leading '#'s these days. Signed-off-by: Stefan Naewe <stefan.naewe@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'mh/doc-remote-helper-xref'Junio C Hamano2014-11-195-0/+22
|\ \ \ | | | | | | | | | | | | | | | | * mh/doc-remote-helper-xref: doc: add some crossrefs between manual pages
| * | | doc: add some crossrefs between manual pagesmh/doc-remote-helper-xrefMax Horn2014-11-115-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In particular, git-fast-import and -export link to each other, and gitremote-helpers links to existing remote helpers, and vice versa. Also link to fast-import from the remote helper spec, as this is relevant for remote helpers using the fast-import format. Signed-off-by: Max Horn <max@quendi.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>