summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2015-01-07receive-pack.c: add execute_commands_atomic functionLibravatar Stefan Beller1-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>
2015-01-07receive-pack.c: move transaction handling in a central placeLibravatar Stefan Beller1-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>
2015-01-07receive-pack.c: move iterating over all commands outside execute_commandsLibravatar Stefan Beller1-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>
2015-01-07receive-pack.c: die instead of error in case of possible future bugLibravatar Stefan Beller1-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>
2015-01-07receive-pack.c: shorten the execute_commands loop over all commandsLibravatar Stefan Beller1-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>
2014-12-22refs.c: let fprintf handle the formattingLibravatar Stefan Beller1-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>
2014-12-22refs.c: don't expose the internal struct ref_lock in the header fileLibravatar Stefan Beller2-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>
2014-12-22lock_any_ref_for_update(): inline functionLibravatar Michael Haggerty2-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>
2014-12-22refs.c: remove unlock_ref/close_ref/commit_ref from the refs apiLibravatar Ronnie Sahlberg2-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>
2014-12-22reflog_expire(): new function in the reference APILibravatar Michael Haggerty3-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>
2014-12-12expire_reflog(): treat the policy callback data as opaqueLibravatar Michael Haggerty1-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>
2014-12-12Move newlog and last_kept_sha1 to "struct expire_reflog_cb"Libravatar Michael Haggerty1-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>
2014-12-12expire_reflog(): move rewrite to flags argumentLibravatar Michael Haggerty1-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>
2014-12-12expire_reflog(): move verbose to flags argumentLibravatar Michael Haggerty1-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>
2014-12-12expire_reflog(): pass flags through to expire_reflog_ent()Libravatar Michael Haggerty1-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>
2014-12-12struct expire_reflog_cb: a new callback data typeLibravatar Michael Haggerty1-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>
2014-12-12Rename expire_reflog_cb to expire_reflog_policy_cbLibravatar Michael Haggerty1-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>
2014-12-12expire_reflog(): move updateref to flags argumentLibravatar Michael Haggerty1-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>
2014-12-12expire_reflog(): move dry_run to flags argumentLibravatar Michael Haggerty1-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>
2014-12-12expire_reflog(): add a "flags" argumentLibravatar Michael Haggerty1-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>
2014-12-12expire_reflog(): extract two policy-related functionsLibravatar Michael Haggerty1-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>
2014-12-12Extract function should_expire_reflog_ent()Libravatar Michael Haggerty1-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>
2014-12-12expire_reflog(): use a lock_file for rewriting the reflog fileLibravatar Michael Haggerty1-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>
2014-12-12expire_reflog(): return early if the reference has no reflogLibravatar Michael Haggerty1-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>
2014-12-12expire_reflog(): rename "ref" parameter to "refname"Libravatar Michael Haggerty1-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>
2014-12-12expire_reflog(): it's not an each_ref_fn anymoreLibravatar Michael Haggerty1-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>
2014-12-12refs.c: add a function to append a reflog entry to a fdLibravatar Ronnie Sahlberg1-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>
2014-12-04refs.c: make ref_transaction_delete a wrapper for ref_transaction_updateLibravatar Ronnie Sahlberg2-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>
2014-12-04refs.c: make ref_transaction_create a wrapper for ref_transaction_updateLibravatar Ronnie Sahlberg1-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>
2014-11-26Git 2.2Libravatar Junio C Hamano2-1/+6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-26RelNotes: spelling & grammar tweaksLibravatar Marc Branchaud1-51/+52
Signed-off-by: Marc Branchaud <marcnarc@xiplink.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-21Git 2.2.0-rc3Libravatar Junio C Hamano2-14/+15
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-20l10n: remove a superfluous translation for push.cLibravatar Jiang Xin6-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>
2014-11-20l10n: de.po: translate 2 messagesLibravatar Ralf Thielow1-3/+1
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2014-11-20l10n: de.po: translate 2 new messagesLibravatar Ralf Thielow1-2/+2
Signed-off-by: Phillip Sz <phillip.szelat@gmail.com> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2014-11-20l10n: batch updates for one trivial changeLibravatar Jiang Xin7-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>
2014-11-20l10n: git.pot: v2.2.0 round 2 (1 updated)Libravatar Jiang Xin1-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>
2014-11-19Merge branch 'sv/submitting-final-patch'Libravatar Junio C Hamano1-1/+1
* sv/submitting-final-patch: SubmittingPatches: final submission is To: maintainer and CC: list
2014-11-19Merge branch 'sn/tutorial-status-output-example'Libravatar Junio C Hamano2-19/+21
* sn/tutorial-status-output-example: gittutorial: fix output of 'git status'
2014-11-19Merge branch 'mh/doc-remote-helper-xref'Libravatar Junio C Hamano5-0/+22
* mh/doc-remote-helper-xref: doc: add some crossrefs between manual pages
2014-11-19Merge branch 'tb/no-relative-file-url'Libravatar Junio C Hamano1-1/+1
* tb/no-relative-file-url: t5705: the file:// URL should be absolute
2014-11-19Merge branch 'cc/interpret-trailers'Libravatar Junio C Hamano1-4/+10
Small fixes to a new experimental command already in 'master'. * cc/interpret-trailers: trailer: display a trailer without its trailing newline trailer: ignore comment lines inside the trailers
2014-11-18Merge git://github.com/git-l10n/git-poLibravatar Junio C Hamano1-2165/+2392
* 'master' of git://github.com/git-l10n/git-po: l10n: Update Catalan translation
2014-11-18Merge branch 'jc/doc-commit-only'Libravatar Junio C Hamano1-2/+3
* jc/doc-commit-only: Documentation/git-commit: clarify that --only/--include records the working tree contents
2014-11-18Merge branch 'ta/tutorial-modernize'Libravatar Junio C Hamano1-1/+1
* ta/tutorial-modernize: gittutorial.txt: remove reference to ancient Git version
2014-11-18Merge branch 'da/difftool'Libravatar Junio C Hamano2-0/+6
Fix-up to a new feature in 'master'. * da/difftool: difftool: honor --trust-exit-code for builtin tools
2014-11-17l10n: Update Catalan translationLibravatar Alex Henrie1-2165/+2392
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
2014-11-17Merge branch 'master' of git://github.com/git-l10n/git-poLibravatar Junio C Hamano1-1990/+2239
* 'master' of git://github.com/git-l10n/git-po: l10n: de.po: translate 62 new messages l10n: de.po: Fixup one translation l10n: de.po: use imperative form for command options
2014-11-15l10n: de.po: translate 62 new messagesLibravatar Ralf Thielow1-1414/+1663
Translate 62 new messages came from git.pot update in 16742b0 (l10n: git.pot: proposed updates for v2.2.0 (+62)). Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2014-11-15l10n: de.po: Fixup one translationLibravatar Stefan Beller1-4/+4
English grammar with German words doesn't make it a German translation. ;) Signed-off-by: Stefan Beller <stefanbeller@gmail.com> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>