1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-06 09:56:12 +02:00

rename "match_refs()" to "match_push_refs()"

Yes, there is a warning that says the function is only used by push in big
red letters in front of this function, but it didn't say a more important
thing it should have said: what the function is for and what it does.

Rename it and document it to avoid future confusion.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano 2011-09-09 11:54:58 -07:00
parent e6bcd97968
commit 29753cddc8
6 changed files with 17 additions and 14 deletions

View File

@ -389,8 +389,8 @@ static int get_push_ref_states(const struct ref *remote_refs,
local_refs = get_local_heads();
push_map = copy_ref_list(remote_refs);
match_refs(local_refs, &push_map, remote->push_refspec_nr,
remote->push_refspec, MATCH_REFS_NONE);
match_push_refs(local_refs, &push_map, remote->push_refspec_nr,
remote->push_refspec, MATCH_REFS_NONE);
states->push.strdup_strings = 1;
for (ref = push_map; ref; ref = ref->next) {

View File

@ -509,7 +509,7 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
flags |= MATCH_REFS_MIRROR;
/* match them up */
if (match_refs(local_refs, &remote_refs, nr_refspecs, refspecs, flags))
if (match_push_refs(local_refs, &remote_refs, nr_refspecs, refspecs, flags))
return -1;
set_ref_status_for_push(remote_refs, args.send_mirror,

View File

@ -1877,8 +1877,8 @@ int main(int argc, char **argv)
}
/* match them up */
if (match_refs(local_refs, &remote_refs,
nr_refspec, (const char **) refspec, push_all)) {
if (match_push_refs(local_refs, &remote_refs,
nr_refspec, (const char **) refspec, push_all)) {
rc = -1;
goto cleanup;
}

View File

@ -1170,12 +1170,15 @@ static struct ref **tail_ref(struct ref **head)
}
/*
* Note. This is used only by "push"; refspec matching rules for
* push and fetch are subtly different, so do not try to reuse it
* without thinking.
* Given the set of refs the local repository has, the set of refs the
* remote repository has, and the refspec used for push, determine
* what remote refs we will update and with what value by setting
* peer_ref (which object is being pushed) and force (if the push is
* forced) in elements of "dst". The function may add new elements to
* dst (e.g. pushing to a new branch, done in match_explicit_refs).
*/
int match_refs(struct ref *src, struct ref **dst,
int nr_refspec, const char **refspec, int flags)
int match_push_refs(struct ref *src, struct ref **dst,
int nr_refspec, const char **refspec, int flags)
{
struct refspec *rs;
int send_all = flags & MATCH_REFS_ALL;

View File

@ -96,8 +96,8 @@ void free_refspec(int nr_refspec, struct refspec *refspec);
char *apply_refspecs(struct refspec *refspecs, int nr_refspec,
const char *name);
int match_refs(struct ref *src, struct ref **dst,
int nr_refspec, const char **refspec, int all);
int match_push_refs(struct ref *src, struct ref **dst,
int nr_refspec, const char **refspec, int all);
void set_ref_status_for_push(struct ref *remote_refs, int send_mirror,
int force_update);

View File

@ -1033,8 +1033,8 @@ int transport_push(struct transport *transport,
if (flags & TRANSPORT_PUSH_MIRROR)
match_flags |= MATCH_REFS_MIRROR;
if (match_refs(local_refs, &remote_refs,
refspec_nr, refspec, match_flags)) {
if (match_push_refs(local_refs, &remote_refs,
refspec_nr, refspec, match_flags)) {
return -1;
}