[PATCH 0/2] replay: add --update-refs option
- From
Siddharth Asthana <siddharthasthana31@gmail.com>
- Date
- Sep 8, 2025, 04:36 UTC
- Message-ID
- <20250908043620.57848-1-siddharthasthana31@gmail.com>
This patch series adds a --update-refs option to git replay. Right now, when you use git replay, you need to pipe its output to git update-ref like this:
git replay --onto main topic1..topic2 | git update-ref --stdin
This works fine, but it means running two commands and doesn't give you atomic transactions by default. The new --update-refs option lets you do the ref updates directly:
git replay --update-refs --onto main topic1..topic2
I discussed this feature with Christian Couder earlier, and we agreed that it would be useful for server-side operations where you want atomic updates.
The way it works: - By default, it uses atomic transactions (all refs get updated or none do) - There's a --batch option if you want some updates to succeed even if others fail - It works with bare repositories, which is important for server operations like Gitaly - When it succeeds, it doesn't print anything (just like git update-ref --stdin) - You can't use --update-refs with the existing --update option
This should help with git replay's goal of being good for server-side operations. It also makes the command simpler to use since you don't need the pipeline anymore, and the atomic behavior is better for reliability.
Siddharth Asthana (2): replay: add --update-refs option for atomic ref updates replay: document --update-refs and --batch options
Documentation/git-replay.adoc | 62 ++++++- builtin/replay.c | 134 +++++++++++++- t/meson.build | 1 + t/t3650-replay-basics.sh | 323 ++++++++++++++++++++++++++++++++++ t/t3651-replay-update-refs.sh | 273 ++++++++++++++++++++++++++++ 5 files changed, 778 insertions(+), 15 deletions(-) create mode 100755 t/t3651-replay-update-refs.sh
-- 2.51.0