You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a configuration option to control the default behavior of git replay
for updating references. This allows users who prefer the traditional
pipeline output to set it once in their config instead of passing
--ref-action=print with every command.
The config option uses string values that mirror the behavior modes:
* replay.refAction = update (default): atomic ref updates
* replay.refAction = print: output commands for pipeline
The command-line --ref-action option always overrides the config setting,
allowing users to temporarily change behavior for a single invocation.
Implementation details:
In cmd_replay(), after parsing command-line options, we check if
--ref-action was provided. If not, we read the configuration using
repo_config_get_string_tmp(). If the config variable is set, we validate
the value and use it to set the ref_action_str:
Config value Internal mode Behavior
──────────────────────────────────────────────────────────────
"update" "update" Atomic ref updates (default)
"print" "print" Pipeline output
(not set) "update" Atomic ref updates (default)
(invalid) error Die with helpful message
If an invalid value is provided, we die() immediately with an error
message explaining the valid options. This catches configuration errors
early and provides clear guidance to users.
The command-line --ref-action option, when provided, overrides the
config value. This precedence allows users to set their preferred default
while still having per-invocation control:
git config replay.refAction print # Set default
git replay --ref-action=update --onto main topic # Override once
The config and command-line option use the same value names ('update'
and 'print') for consistency and clarity. This makes it immediately
obvious how the config maps to the command-line option, addressing
feedback about the relationship between configuration and command-line
options being clear to users.
Examples:
$ git config --global replay.refAction print
$ git replay --onto main topic1..topic2 | git update-ref --stdin
$ git replay --ref-action=update --onto main topic1..topic2
$ git config replay.refAction update
$ git replay --onto main topic1..topic2 # Updates refs directly
The implementation follows Git's standard configuration precedence:
command-line options override config values, which matches user
expectations across all Git commands.
Helped-by: Junio C Hamano <[email protected]>
Helped-by: Elijah Newren <[email protected]>
Helped-by: Christian Couder <[email protected]>
Helped-by: Phillip Wood <[email protected]>
Signed-off-by: Siddharth Asthana <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
0 commit comments