diff options
author | Brad King <brad.king@kitware.com> | 2013-09-04 11:22:43 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-09-04 11:10:28 -0700 |
commit | 98aee92d5c9e5161a8c11b7666996e4ffffe80ab (patch) | |
tree | de4b08360058b244cc3ef5b2858d1da7fc4bad26 /contrib/ciabot | |
parent | refs: add function to repack without multiple refs (diff) | |
download | tgif-98aee92d5c9e5161a8c11b7666996e4ffffe80ab.tar.xz |
refs: add update_refs for multiple simultaneous updates
Add 'struct ref_update' to encode the information needed to update or
delete a ref (name, new sha1, optional old sha1, no-deref flag). Add
function 'update_refs' accepting an array of updates to perform. First
sort the input array to order locks consistently everywhere and reject
multiple updates to the same ref. Then acquire locks on all refs with
verified old values. Then update or delete all refs accordingly. Fail
if any one lock cannot be obtained or any one old value does not match.
Though the refs themselves cannot be modified together in a single
atomic transaction, this function does enable some useful semantics.
For example, a caller may create a new branch starting from the head of
another branch and rewind the original branch at the same time. This
transfers ownership of commits between branches without risk of losing
commits added to the original branch by a concurrent process, or risk of
a concurrent process creating the new branch first.
Signed-off-by: Brad King <brad.king@kitware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/ciabot')
0 files changed, 0 insertions, 0 deletions