Skip to content

Commit 470bbbc

Browse files
committed
Merge branch 'jc/match-refs-clarify'
* jc/match-refs-clarify: rename "match_refs()" to "match_push_refs()" send-pack: typofix error message
2 parents 1020fbc + 29753cd commit 470bbbc

File tree

6 files changed

+18
-15
lines changed

6 files changed

+18
-15
lines changed

builtin/remote.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,8 @@ static int get_push_ref_states(const struct ref *remote_refs,
389389
local_refs = get_local_heads();
390390
push_map = copy_ref_list(remote_refs);
391391

392-
match_refs(local_refs, &push_map, remote->push_refspec_nr,
393-
remote->push_refspec, MATCH_REFS_NONE);
392+
match_push_refs(local_refs, &push_map, remote->push_refspec_nr,
393+
remote->push_refspec, MATCH_REFS_NONE);
394394

395395
states->push.strdup_strings = 1;
396396
for (ref = push_map; ref; ref = ref->next) {

builtin/send-pack.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ int send_pack(struct send_pack_args *args,
334334
demux.data = fd;
335335
demux.out = -1;
336336
if (start_async(&demux))
337-
die("receive-pack: unable to fork off sideband demultiplexer");
337+
die("send-pack: unable to fork off sideband demultiplexer");
338338
in = demux.out;
339339
}
340340

@@ -509,7 +509,7 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
509509
flags |= MATCH_REFS_MIRROR;
510510

511511
/* match them up */
512-
if (match_refs(local_refs, &remote_refs, nr_refspecs, refspecs, flags))
512+
if (match_push_refs(local_refs, &remote_refs, nr_refspecs, refspecs, flags))
513513
return -1;
514514

515515
set_ref_status_for_push(remote_refs, args.send_mirror,

http-push.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1869,8 +1869,8 @@ int main(int argc, char **argv)
18691869
}
18701870

18711871
/* match them up */
1872-
if (match_refs(local_refs, &remote_refs,
1873-
nr_refspec, (const char **) refspec, push_all)) {
1872+
if (match_push_refs(local_refs, &remote_refs,
1873+
nr_refspec, (const char **) refspec, push_all)) {
18741874
rc = -1;
18751875
goto cleanup;
18761876
}

remote.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,12 +1145,15 @@ static struct ref **tail_ref(struct ref **head)
11451145
}
11461146

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

remote.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ void free_refspec(int nr_refspec, struct refspec *refspec);
9696
char *apply_refspecs(struct refspec *refspecs, int nr_refspec,
9797
const char *name);
9898

99-
int match_refs(struct ref *src, struct ref **dst,
100-
int nr_refspec, const char **refspec, int all);
99+
int match_push_refs(struct ref *src, struct ref **dst,
100+
int nr_refspec, const char **refspec, int all);
101101
void set_ref_status_for_push(struct ref *remote_refs, int send_mirror,
102102
int force_update);
103103

transport.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,8 +1026,8 @@ int transport_push(struct transport *transport,
10261026
if (flags & TRANSPORT_PUSH_MIRROR)
10271027
match_flags |= MATCH_REFS_MIRROR;
10281028

1029-
if (match_refs(local_refs, &remote_refs,
1030-
refspec_nr, refspec, match_flags)) {
1029+
if (match_push_refs(local_refs, &remote_refs,
1030+
refspec_nr, refspec, match_flags)) {
10311031
return -1;
10321032
}
10331033

0 commit comments

Comments
 (0)