diff options
| author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2022-08-04 18:28:30 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-08-04 14:12:23 -0700 |
| commit | 2f8b3ea662269e5f8e05228eb7a816606559ca23 (patch) | |
| tree | f4543cd64608b471783114c47300f24d324d8e74 /builtin/help.c | |
| parent | The sixth batch (diff) | |
| download | git-2f8b3ea662269e5f8e05228eb7a816606559ca23.tar.gz git-2f8b3ea662269e5f8e05228eb7a816606559ca23.zip | |
help.c: refactor drop_prefix() to use a "switch" statement"
Refactor the drop_prefix() function in in help.c to make it easier to
strip prefixes from categories that aren't "CAT_guide". There are no
functional changes here, by doing this we make a subsequent functional
change's diff smaller.
As before we first try to strip "git-" unconditionally, if that works
we'll return the stripped string. Then we'll strip "git" if the
command is in "CAT_guide".
This means that we'd in principle strip "git-foo" down to "foo" if
it's in CAT_guide. That doesn't make much sense, and we don't have
such an entry in command-list.txt, but let's preserve that behavior
for now.
While we're at it remove a stray newline that had been added after the
"return name;" statement.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/help.c')
0 files changed, 0 insertions, 0 deletions
