mbox series

[0/2] update-ref: Allow creation of multiple transactions

Message ID cover.1604501265.git.ps@pks.im (mailing list archive)
Headers show
Series update-ref: Allow creation of multiple transactions | expand

Message

Patrick Steinhardt Nov. 4, 2020, 2:57 p.m. UTC
Hi,

A few months back, I've implemented a more interactive protocol for
`git-update-ref --stdin`, which converted it to read commands linewise
and allow for more control via a set of new controlling commands. One
thing that was noticeably missing was the ability to create multiple
transactions in a single git-update-ref invocation.

As Peff rightly pointed out a few months back, we're actually almost
there to have that. So I took a look today and finally decided to
implement it while I was busy implementing another series. And in fact,
it really didn't require a lof of changes.

So with this small series, it's now possible to start new transaction
after the current transaction has either been committed or aborted. E.g.
sessions like the following are now possible:

    > start
    start: ok
    > create refs/heads/test $A
    > commit
    commit: ok
    > start
    start: ok
    > update refs/heads/test $B $A
    > commit
    commit: ok
    > start
    start: ok
    > update refs/heads/test $A $B
    > abort
    abort: ok
    > start
    start: ok
    > delete refs/heads/test $B
    > commit
    commit: ok

I've also updated the performance test in p1400 to use this new
mechanism, which is a much more direct way to test what we want to test
in there compared to using not-atomic pushes.

Patrick

Patrick Steinhardt (2):
  update-ref: Allow creation of multiple transactions
  p1400: Use `git-update-ref --stdin` to test multiple transactions

 Documentation/git-update-ref.txt |  3 +-
 builtin/update-ref.c             | 13 ++++++++-
 t/perf/p1400-update-ref.sh       | 20 +++++--------
 t/t1400-update-ref.sh            | 50 ++++++++++++++++++++++++++++++++
 4 files changed, 71 insertions(+), 15 deletions(-)