@matheusbsbs / matheus-bagliano / commits / 5f48cb95aa
Fork 0

remote: make match_refs() not short-circuit

match_refs() returns non-zero if there is an error in match_explicit_refs(), without handling any remaining pattern ref specs. Its existing callers exit upon receiving non-zero, so a partial result is of no consequence to them; however a new caller, builtin-remote, is interested in the complete result even if there are errors in match_explicit_refs(). Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jay Soffian committed Feb 25, 2009 at 03:32 UTC 5f48cb95aa0d7311623df76249a1c8a1962550f5
1 file changed +4 -2
remote.c
+4 -2
@@ -1052,6 +1052,7 @@ int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
1052 struct refspec *rs;
1053 int send_all = flags & MATCH_REFS_ALL;
1054 int send_mirror = flags & MATCH_REFS_MIRROR;
1055 + int errs;
1056 static const char *default_refspec[] = { ":", 0 };
1057
1058 if (!nr_refspec) {
@@ -1059,8 +1060,7 @@ int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
1060 refspec = default_refspec;
1061 }
1062 rs = parse_push_refspec(nr_refspec, (const char **) refspec);
1062 - if (match_explicit_refs(src, dst, dst_tail, rs, nr_refspec))
1063 - return -1;
1063 + errs = match_explicit_refs(src, dst, dst_tail, rs, nr_refspec);
1064
1065 /* pick the remainder */
1066 for ( ; src; src = src->next) {
@@ -1116,6 +1116,8 @@ int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
1116 free_name:
1117 free(dst_name);
1118 }
1119 + if (errs)
1120 + return -1;
1121 return 0;
1122 }
1123