git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v4 2/3] replay: make atomic ref updates the default behavior

From
Siddharth Asthana <siddharthasthana31@gmail.com>
Date
Oct 28, 2025, 19:39 UTC
Message-ID
<0c58d734-d7fe-4b2a-8231-c123b74601d6@gmail.com>
In-Reply-To
<CAP8UFD00rE7gF+baidmoi7nYwVKa3UDQgj+TB4wJLtjJF7u9gA@mail.gmail.com>
On 24/10/25 16:07, Christian Couder wrote:
Show 8 quoted lines
> On Wed, Oct 22, 2025 at 8:51 PM Siddharth Asthana
> <siddharthasthana31@gmail.com> wrote:
>
> [...]
>
>> However, it should be noted that all three of these are somewhat
>> special cases; users, whether on the client or server side, would
>> almost certainly find it more ergonomical to simply have the updating

Hi Christian, Thanks for the detailed review! All good points:

> Nit: maybe: s/ergonomical/ergonomic/
Will be fixed in v5!
Show 17 quoted lines
>> of refs be the default.
> [...]
>
>> Change the default behavior to update refs directly, and atomically (at
>> least to the extent supported by the refs backend in use). This
>> eliminates the process coordination overhead for the common case.
>>
>> For users needing the traditional pipeline workflow, add a new
>> --ref-action=<mode> option that preserves the original behavior:
>>
>>    git replay --ref-action=print --onto main topic1..topic2 | git update-ref --stdin
>>
>> The mode can be:
>>    * update (default): Update refs directly using an atomic transaction
>>    * print: Output update-ref commands for pipeline use
> Nit: maybe it should be mentioned that the command is still
> experimental, so it's OK to change the default like this.

Good point, I will add a note in the commit message that since git-replay is still experimental, changing the default behavior is acceptable

Show 14 quoted lines
>
>> +--ref-action[=<mode>]::
>> +       Control how references are updated. The mode can be:
>> ++
>> +--
>> +       * `update` (default): Update refs directly using an atomic transaction.
>> +         All refs are updated or none are (all-or-nothing behavior).
>> +       * `print`: Output update-ref commands for pipeline use. This is the
>> +         traditional behavior where output can be piped to `git update-ref --stdin`.
>> +--
>> ++
>> +The default mode can be configured via `replay.refAction` configuration option.
> Nit: s/via `replay.refAction` configuration option/via the
> `replay.refAction` configuration variable/
Good catch, I will standardize on "configuration variable" throughout.
Show 14 quoted lines
>
> (It seems that "configuration variable" is used around 6 times more
> than "configuration option", so we may want to standardize this
> wording.)
>
>> @@ -54,8 +68,11 @@ include::rev-list-options.adoc[]
>>   OUTPUT
>>   ------
>>
>> -When there are no conflicts, the output of this command is usable as
>> -input to `git update-ref --stdin`.  It is of the form:
>> +By default (with `--ref-action=update`), this command produces no output on
> Nit: s/By default (with `--ref-action=update`)/By default, or with
> `--ref-action=update`,/
Much clearer wording
Show 10 quoted lines
>
> I think it's better to be very explicit here, especially as we mention
> `--ref-action=print` below.
>
> [...]
>
>> -       const char * const replay_usage[] = {
>> +       const char *const replay_usage[] = {
> Nit: Not sure this change is worth it, but I understand that it might
> help pass some automated/CI tests, so not a big issue.

Actually, Junio mentioned in another thread that the prevalent style in the codebase is `const char * const` (space on both sides), so I'll revert this change in v5.

Show 14 quoted lines
>
> [...]
>
>> +       /* Default to update mode if not specified */
>> +       if (!ref_action_str)
>> +               ref_action_str = "update";
>> +
>> +       /* Parse ref action mode */
>> +       if (!strcmp(ref_action_str, "update"))
>> +               ref_action = REF_ACTION_UPDATE;
> Nit: maybe:
>
>         if (!ref_action_str || !strcmp(ref_action_str, "update"))
>                 ref_action = REF_ACTION_UPDATE;
That's cleaner - I will combine the logic in v5.
Show 17 quoted lines
>
>> +       else if (!strcmp(ref_action_str, "print"))
>> +               ref_action = REF_ACTION_PRINT;
>> +       else
>> +               die(_("unknown --ref-action mode '%s'"), ref_action_str);
>> +
> [...]
>
>>   test_expect_success 'using replay on bare repo to rebase multiple divergent branches, including contained ones' '
>> -       git -C bare replay --contained --onto main ^main topic2 topic3 topic4 >result &&
>> +       git -C bare replay --ref-action=print --contained --onto main ^main topic2 topic3 topic4 >result &&
>>
>>          test_line_count = 4 result &&
>>          cut -f 3 -d " " result >new-branch-tips &&
> Are there tests with the new default behavior added? It looks like all
> the changes in the test script are about adding "--ref-action=print"
> to an existing test.

Yes, they're in patch 2 - the atomic behavior tests that verify no output and direct ref updates. I should highlight this better in the commit message since they test the absence of output (the new default).

Thanks, Siddharth

Previous: Siddharth AsthanaNext: Siddharth Asthana
Message 80 of 125 in “replay: add --update-refs option”
  1. 0/2 replay: add --update-refs optionSiddharth Asthana, Sep 8, 2025
  2. 1/2 replay: add --update-refs optionSiddharth Asthana, Sep 8, 2025
  3. Patrick SteinhardtSep 8, 2025
  4. Siddharth AsthanaSep 9, 2025
  5. Patrick SteinhardtSep 9, 2025
  6. Elijah NewrenSep 9, 2025
  7. Siddharth AsthanaSep 10, 2025
  8. 2/2 replay: document --update-refs and --batch optionsSiddharth Asthana, Sep 8, 2025
  9. Christian CouderSep 8, 2025
  10. Siddharth AsthanaSep 9, 2025
  11. Christian CouderSep 9, 2025
  12. Siddharth AsthanaSep 10, 2025
  13. Kristoffer HaugsbakkSep 8, 2025
  14. Siddharth AsthanaSep 9, 2025
  15. Andrei RybakSep 9, 2025
  16. Siddharth AsthanaSep 10, 2025
  17. Christian CouderSep 8, 2025
  18. Siddharth AsthanaSep 9, 2025
  19. Kristoffer HaugsbakkSep 8, 2025
  20. Siddharth AsthanaSep 9, 2025
  21. Elijah NewrenSep 9, 2025
  22. Christian CouderSep 9, 2025
  23. Elijah NewrenSep 9, 2025
  24. Junio C HamanoSep 9, 2025
  25. Elijah NewrenSep 9, 2025
  26. 0/1 replay: make atomic ref updates the default behaviorSiddharth Asthana, Sep 26, 2025
  27. 1/1 replay: make atomic ref updates the default behaviorSiddharth Asthana, Sep 26, 2025
  28. Christian CouderSep 30, 2025
  29. Siddharth AsthanaOct 2, 2025
  30. Christian CouderOct 3, 2025
  31. Elijah NewrenOct 2, 2025
  32. Christian CouderOct 3, 2025
  33. Phillip WoodSep 30, 2025
  34. Karthik NayakOct 2, 2025
  35. Siddharth AsthanaOct 2, 2025
  36. Siddharth AsthanaOct 2, 2025
  37. Phillip WoodOct 8, 2025
  38. Siddharth AsthanaOct 8, 2025
  39. Elijah NewrenOct 8, 2025
  40. Siddharth AsthanaOct 8, 2025
  41. Phillip WoodOct 9, 2025
  42. Elijah NewrenOct 2, 2025
  43. Junio C HamanoOct 2, 2025
  44. Siddharth AsthanaOct 2, 2025
  45. Siddharth AsthanaOct 2, 2025
  46. Christian CouderOct 3, 2025
  47. Siddharth AsthanaOct 8, 2025
  48. Elijah NewrenOct 3, 2025
  49. Junio C HamanoOct 3, 2025
  50. Siddharth AsthanaOct 8, 2025
  51. Junio C HamanoOct 8, 2025
  52. Siddharth AsthanaOct 8, 2025
  53. Elijah NewrenOct 8, 2025
  54. Siddharth AsthanaOct 8, 2025
  55. Kristoffer HaugsbakkOct 2, 2025
  56. Siddharth AsthanaOct 2, 2025
  57. Kristoffer HaugsbakkOct 3, 2025
  58. Siddharth AsthanaOct 8, 2025
  59. Elijah NewrenOct 8, 2025
  60. Kristoffer HaugsbakkOct 8, 2025
  61. Siddharth AsthanaOct 8, 2025
  62. 0/3 replay: make atomic ref updates the defaultSiddharth Asthana, Oct 13, 2025
  63. 1/3 replay: use die_for_incompatible_opt2() for option validationSiddharth Asthana, Oct 13, 2025
  64. 2/3 replay: make atomic ref updates the default behaviorSiddharth Asthana, Oct 13, 2025
  65. Junio C HamanoOct 13, 2025
  66. Siddharth AsthanaOct 15, 2025
  67. 3/3 replay: add replay.defaultAction config optionSiddharth Asthana, Oct 13, 2025
  68. Junio C HamanoOct 13, 2025
  69. Siddharth AsthanaOct 15, 2025
  70. Christian CouderOct 15, 2025
  71. Junio C HamanoOct 15, 2025
  72. 0/3 replay: make atomic ref updates the defaultSiddharth Asthana, Oct 22, 2025
  73. 1/3 replay: use die_for_incompatible_opt2() for option validationSiddharth Asthana, Oct 22, 2025
  74. 2/3 replay: make atomic ref updates the default behaviorSiddharth Asthana, Oct 22, 2025
  75. Junio C HamanoOct 22, 2025
  76. Siddharth AsthanaOct 28, 2025
  77. Christian CouderOct 24, 2025
  78. Junio C HamanoOct 24, 2025
  79. Siddharth AsthanaOct 28, 2025
  80. Siddharth AsthanaOct 28, 2025
  81. 3/3 replay: add replay.refAction config optionSiddharth Asthana, Oct 22, 2025
  82. Christian CouderOct 24, 2025
  83. Junio C HamanoOct 24, 2025
  84. Siddharth AsthanaOct 28, 2025
  85. Siddharth AsthanaOct 28, 2025
  86. Phillip WoodOct 24, 2025
  87. Phillip WoodOct 24, 2025
  88. Siddharth AsthanaOct 28, 2025
  89. Siddharth AsthanaOct 28, 2025
  90. Junio C HamanoOct 23, 2025
  91. Junio C HamanoOct 25, 2025
  92. Siddharth AsthanaOct 28, 2025
  93. Christian CouderOct 24, 2025
  94. 0/3 replay: make atomic ref updates the defaultSiddharth Asthana, Oct 28, 2025
  95. 1/3 replay: use die_for_incompatible_opt2() for option validationSiddharth Asthana, Oct 28, 2025
  96. 2/3 replay: make atomic ref updates the default behaviorSiddharth Asthana, Oct 28, 2025
  97. 3/3 replay: add replay.refAction config optionSiddharth Asthana, Oct 28, 2025
  98. Christian CouderOct 29, 2025
  99. Siddharth AsthanaOct 29, 2025
  100. 0/3 replay: make atomic ref updates the defaultSiddharth Asthana, Oct 30, 2025
  101. 1/3 replay: use die_for_incompatible_opt2() for option validationSiddharth Asthana, Oct 30, 2025
  102. Elijah NewrenOct 31, 2025
  103. Siddharth AsthanaNov 5, 2025
  104. 2/3 replay: make atomic ref updates the default behaviorSiddharth Asthana, Oct 30, 2025
  105. Elijah NewrenOct 31, 2025
  106. Junio C HamanoOct 31, 2025
  107. Siddharth AsthanaNov 5, 2025
  108. Phillip WoodNov 3, 2025
  109. Siddharth AsthanaNov 3, 2025
  110. Phillip WoodNov 4, 2025
  111. 3/3 replay: add replay.refAction config optionSiddharth Asthana, Oct 30, 2025
  112. Christian CouderOct 31, 2025
  113. Siddharth AsthanaNov 5, 2025
  114. Elijah NewrenOct 31, 2025
  115. Siddharth AsthanaNov 5, 2025
  116. Elijah NewrenOct 31, 2025
  117. 0/3 replay: make atomic ref updates the defaultSiddharth Asthana, Nov 5, 2025
  118. 1/3 replay: use die_for_incompatible_opt2() for option validationSiddharth Asthana, Nov 5, 2025
  119. 2/3 replay: make atomic ref updates the default behaviorSiddharth Asthana, Nov 5, 2025
  120. 3/3 replay: add replay.refAction config optionSiddharth Asthana, Nov 5, 2025
  121. Elijah NewrenNov 6, 2025
  122. Siddharth AsthanaNov 8, 2025
  123. Elijah NewrenNov 8, 2025
  124. Phillip WoodNov 7, 2025
  125. Siddharth AsthanaNov 8, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.