summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e6bcd97)
raw | patch | inline | side by side (parent: e6bcd97)
author | Junio C Hamano <gitster@pobox.com> | |
Fri, 9 Sep 2011 18:54:58 +0000 (11:54 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 12 Sep 2011 23:41:53 +0000 (16:41 -0700) |
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>
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>
builtin/remote.c | patch | blob | history | |
builtin/send-pack.c | patch | blob | history | |
http-push.c | patch | blob | history | |
remote.c | patch | blob | history | |
remote.h | patch | blob | history | |
transport.c | patch | blob | history |
diff --git a/builtin/remote.c b/builtin/remote.c
index f2a9c26dc3494c0881ca3f91b44785c4b52caae7..f16b5443ccbd083110886aafb51fc230e8f33288 100644 (file)
--- a/builtin/remote.c
+++ b/builtin/remote.c
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) {
diff --git a/builtin/send-pack.c b/builtin/send-pack.c
index 87833f4902bc08d9cfacaf880b87a5a02abbf3d1..e0b8030f2b31ee337bc2d2e0925788ec6cd92e0f 100644 (file)
--- a/builtin/send-pack.c
+++ b/builtin/send-pack.c
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,
diff --git a/http-push.c b/http-push.c
index 376331a76fcde24e6828eba0b88fec26d93fe56f..02f46a538b040d387a0840c4f0735ae289a2c4be 100644 (file)
--- a/http-push.c
+++ b/http-push.c
}
/* 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;
}
diff --git a/remote.c b/remote.c
index b8ecfa5d9558e3824872ad6778fc344681cc8d5c..536ffa35cdd6a9e48edd62c9cae619144fd9ecb7 100644 (file)
--- a/remote.c
+++ b/remote.c
}
/*
- * 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;
diff --git a/remote.h b/remote.h
index 9a30a9dba64825950f7a0448ad8b64581c0b8fae..67294778b6a7af3f0fa2c3cb1c0a34cc11d508b1 100644 (file)
--- a/remote.h
+++ b/remote.h
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);
diff --git a/transport.c b/transport.c
index fa279d531fe1b99841424080487e685fbe04e5bb..740a73935cc1e65457916a4e52c4b38e94827332 100644 (file)
--- a/transport.c
+++ b/transport.c
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;
}