From: Harald Nordgren Date: Fri, 23 Oct 2026 22:47:12 GMT Subject: Re: [PATCH v2 1/3] reflog: name the strings that mark switches, renames and rebase steps Message-ID: In-Reply-To: On Fri, Oct 23, 2026 at 11:19 PM Junio C Hamano wrote: > > "Harald Nordgren via GitGitGadget" writes: > > > Name the strings once in reflog.h and use the names wherever the > > messages are written or read: the "checkout: moving from " prefix > > written by "git checkout", the "Branch: renamed " prefix written by > > "git branch -m", and the "start", "finish" and "abort" steps written > > by "git rebase". > > > > No change in behavior. > > Would it make sense to test the behaviour to demonstrate this claim? We have previous tests for this which I think would break if this was incorrectly refactored. Harald On Fri, Oct 23, 2026 at 11:19 PM Junio C Hamano wrote: > > "Harald Nordgren via GitGitGadget" writes: > > > Name the strings once in reflog.h and use the names wherever the > > messages are written or read: the "checkout: moving from " prefix > > written by "git checkout", the "Branch: renamed " prefix written by > > "git branch -m", and the "start", "finish" and "abort" steps written > > by "git rebase". > > > > No change in behavior. > > Would it make sense to test the behaviour to demonstrate this claim? > > > Signed-off-by: Harald Nordgren > > --- > > builtin/branch.c | 3 ++- > > builtin/checkout.c | 3 ++- > > builtin/rebase.c | 17 +++++++++-------- > > object-name.c | 3 ++- > > reflog.h | 6 ++++++ > > sequencer.c | 13 +++++++------ > > wt-status.c | 3 ++- > > 7 files changed, 30 insertions(+), 18 deletions(-) > > > diff --git a/reflog.h b/reflog.h > > index 3bdd1ca8a5..32c3737db4 100644 > > --- a/reflog.h > > +++ b/reflog.h > > @@ -2,6 +2,12 @@ > > #define REFLOG_H > > #include "refs.h" > > > > +#define REFLOG_SWITCH_PREFIX "checkout: moving from " > > +#define REFLOG_RENAME_PREFIX "Branch: renamed " > > +#define REFLOG_STEP_START "start" > > +#define REFLOG_STEP_FINISH "finish" > > +#define REFLOG_STEP_ABORT "abort" > > I was hoping that we could eventually make reflog messages > translatable, by splitting each entry in the reflog record into > two: a human-readable part (shown in the usual output of the > 'git reflog' command) and a machine-parseable part to be used > exactly for features like this. We would hopefully need to update > only reflog_message() and its dozens of callers to make it happen. > > I wonder how far this change will set us back from that future. > The best case would be that this detour does not make it any > harder. The locations this patch touches are where we would > need to leave clues in the machine-parseable format, and the > locations touched by later patches in the series are the places > that need to be updated to look at the machine-parseable part. > > The changes in this series looked sensible, though.