diff options
author | Jeff King <peff@peff.net> | 2017-03-15 16:08:02 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-15 14:02:36 -0700 |
commit | ffddfc6328fd3c8b0e8ee69144ec2dda5c766364 (patch) | |
tree | 215aacba5a36d3b2ba8885dbd433b2e16890092e /sha1_file.c | |
parent | rev-parse: add helper for parsing "--foo/--foo=" (diff) | |
download | tgif-ffddfc6328fd3c8b0e8ee69144ec2dda5c766364.tar.xz |
rev-parse: simplify parsing of ref options
All of these options do the same thing "--foo" iterates over
the "foo" refs, and "--foo=<glob>" does the same with a
glob. We can factor this into its own function to avoid
repeating ourselves.
There are two subtleties to note:
- the original called for_each_branch_ref(), etc, in the
non-glob case. Now we will call for_each_ref_in("refs/heads/")
which is exactly what for_each_branch_ref() did under
the hood.
- for --glob, we'll call for_each_glob_ref_in() with a
NULL "prefix" argument. Which is exactly what
for_each_glob_ref() was doing already.
So both cases should behave identically, and it seems
reasonable to assume that this will remain the same. The
functions we are calling now are the more-generic ones, and
the ones we are dropping are just convenience wrappers.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1_file.c')
0 files changed, 0 insertions, 0 deletions