]> Kevux Git Server - rit/commit
checkout: pass program-readable token to unified "main"
authorJunio C Hamano <gitster@pobox.com>
Thu, 29 Jan 2026 19:06:15 +0000 (11:06 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 9 Feb 2026 16:33:17 +0000 (08:33 -0800)
commit2096948158ea0b253a68a81c691fdf88ff00589a
tree6d097c0e91d5d6c5f2efb8505f06eced7521df6c
parent9a2fb147f2c61d0cab52c883e7e26f5b7948e3ed
checkout: pass program-readable token to unified "main"

The "git checkout", "git switch", and "git restore" commands share a
single implementation, checkout_main(), which switches error message
it gives using the usage string passed by each of these three
front-ends.

In order to be able to tweak behaviours of the commands based on
which one we are executing, invent an enum that denotes which one of
these three commands is currently executing, and pass that to
checkout_main() instead.  With this step, there is no externally
visible behaviour change, as this enum parameter is only used to
choose among the three usage strings.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/checkout.c