diff options
author | Jeff King <peff@peff.net> | 2017-05-19 14:52:00 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-05-24 03:59:27 +0200 |
commit | 62faad5aa5441942c333c15f3afa03a6e2dd994d (patch) | |
tree | 21f47d8f1c7c5a134f38c26fb0a8050223b9f09f /sha1_name.c | |
parent | handle_revision_arg: hoist ".." check out of range parsing (diff) | |
download | git-62faad5aa5441942c333c15f3afa03a6e2dd994d.tar.xz git-62faad5aa5441942c333c15f3afa03a6e2dd994d.zip |
handle_revision_arg: add handle_dotdot() helper
The handle_revision_arg function is rather long, and a big
chunk of it is handling the range operators. Let's pull that
out to a separate helper. While we're doing so, we can clean
up a few of the rough edges that made the flow hard to
follow:
- instead of manually restoring *dotdot (that we overwrote
with a NUL), do the real work in a sub-helper, which
makes it clear that the munge/restore lines are a
matched pair
- eliminate a goto which wasn't actually used for control
flow, but only to avoid duplicating a few lines
(instead, those lines are pushed into another helper
function)
- use early returns instead of deep nesting
- consistently name all variables for the left-hand side
of the range as "a" (rather than "this" or "from") and
the right-hand side as "b" (rather than "next", or using
the unadorned "sha1" or "flags" from the main function).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1_name.c')
0 files changed, 0 insertions, 0 deletions