remote: reorganize check_pattern_match()
commitdb70a04cbb343a58e7be93e7f581d049cf901b26
authorFelipe Contreras <felipe.contreras@gmail.com>
Wed, 22 Feb 2012 22:43:39 +0000 (23 00:43 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 23 Feb 2012 00:01:50 +0000 (22 16:01 -0800)
tree05d61cdac1a47d58922818246d9f4f32c5333701
parentb1d8b1f3f17c7550beeff267356bab89e10c6381
remote: reorganize check_pattern_match()

The function match_name_with_pattern() is called twice, once to see if a
pattern matches with the name, and again to learn what the matched pattern
maps the name to.  Since check_pattern_match() is only used in one place,
we can just reorganize it to make a single call and fetch the values at
the same time.

This changes the meaning of check_pattern_match() that used to check which
pattern in the array of refspecs matched the given ref, to return the name
of the remote ref the given ref is mapped to.

Rename it to get_ref_match() which actually describes more closely what
it's actually doing now.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
remote.c