Commit ffddfc6
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>1 parent 9d16ca6 commit ffddfc6
1 file changed
Lines changed: 16 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
554 | 554 | | |
555 | 555 | | |
556 | 556 | | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
557 | 566 | | |
558 | 567 | | |
559 | 568 | | |
| |||
746 | 755 | | |
747 | 756 | | |
748 | 757 | | |
749 | | - | |
750 | | - | |
751 | | - | |
752 | | - | |
753 | | - | |
754 | | - | |
755 | | - | |
756 | | - | |
757 | | - | |
758 | | - | |
759 | | - | |
760 | | - | |
761 | | - | |
762 | | - | |
763 | | - | |
| 758 | + | |
| 759 | + | |
764 | 760 | | |
765 | 761 | | |
766 | | - | |
767 | | - | |
768 | | - | |
| 762 | + | |
| 763 | + | |
769 | 764 | | |
770 | 765 | | |
771 | 766 | | |
772 | | - | |
773 | | - | |
774 | | - | |
775 | | - | |
776 | | - | |
777 | | - | |
778 | | - | |
779 | | - | |
| 767 | + | |
780 | 768 | | |
781 | 769 | | |
782 | | - | |
783 | | - | |
784 | | - | |
| 770 | + | |
| 771 | + | |
785 | 772 | | |
786 | 773 | | |
787 | 774 | | |
| |||
0 commit comments