[PATCH v2 00/27] Clean up update-refs --stdin and implement ref_transaction
- From
Michael Haggerty <mhagger@alum.mit.edu>
- Date
- Mar 24, 2014, 17:56 UTC
- Message-ID
- <1395683820-17304-1-git-send-email-mhagger@alum.mit.edu>
This is v2 of this patch series. See also [1] for more context.
Thanks to Brad, Junio, and Johan for their feedback on v1 [2]. I think I have addressed all of your points.
Changes relative to v1:
* Rename the functions associated with ref_transactions to be more reminiscent of database transactions:
* create_ref_transaction() -> ref_transaction_begin() * free_ref_transaction() -> ref_transaction_rollback() * queue_update_ref() -> ref_transaction_update() * queue_create_ref() -> ref_transaction_create() * queue_delete_ref() -> ref_transaction_delete() * commit_ref_transaction() -> ref_transaction_commit()
* Change ref_transaction_commit() to also free the transaction, so the user doesn't have to think about memory resources at all.
* Fix backwards compatibility of "git update-ref --stdin -z"'s handling of the "create" command: allow <newvalue> to be the empty string, treating it the same zeros. But deprecate this usage.
* Rebased to current master (there were no conflicts).
[1] http://article.gmane.org/gmane.comp.version-control.git/243726 [2] http://thread.gmane.org/gmane.comp.version-control.git/243731
Michael Haggerty (27):
t1400: Fix name and expected result of one test
t1400: Provide more usual input to the command
parse_arg(): Really test that argument is properly terminated
t1400: Add some more tests involving quoted arguments
refs.h: Rename the action_on_err constants
update_refs(): Fix constness
update-ref --stdin: Read the whole input at once
parse_cmd_verify(): Copy old_sha1 instead of evaluating <oldvalue>
twice
update-ref.c: Extract a new function, parse_refname()
update-ref --stdin: Improve error messages for invalid values
update-ref --stdin: Make error messages more consistent
update-ref --stdin: Simplify error messages for missing oldvalues
t1400: Test that stdin -z update treats empty <newvalue> as zeros
update-ref.c: Extract a new function, parse_next_sha1()
update-ref --stdin -z: Deprecate interpreting the empty string as
zeros
t1400: Test one mistake at a time
update-ref --stdin: Improve the error message for unexpected EOF
update-ref --stdin: Harmonize error messages
refs: Add a concept of a reference transaction
update-ref --stdin: Reimplement using reference transactions
refs: Remove API function update_refs()
struct ref_update: Rename field "ref_name" to "refname"
struct ref_update: Store refname as a FLEX_ARRAY.
ref_transaction_commit(): Introduce temporary variables
struct ref_update: Add a lock member
struct ref_update: Add type field
ref_transaction_commit(): Work with transaction->updates in placeDocumentation/git-update-ref.txt | 18 +- builtin/checkout.c | 2 +- builtin/clone.c | 9 +- builtin/merge.c | 6 +- builtin/notes.c | 6 +- builtin/reset.c | 6 +- builtin/update-ref.c | 425 ++++++++++++++++++++------------- contrib/examples/builtin-fetch--tool.c | 3 +- notes-cache.c | 2 +- notes-utils.c | 3 +- refs.c | 192 +++++++++++---- refs.h | 94 ++++++-- t/t1400-update-ref.sh | 100 +++++--- 13 files changed, 582 insertions(+), 284 deletions(-)
-- 1.9.0