Skip to content

Commit

Permalink
get_fetch_map(): tighten checks on dest refs
Browse files Browse the repository at this point in the history
The code to check the refname we store the fetched result locally did not
bother checking the first 5 bytes of it, presumably assuming that it
always begin with "refs/".  For a fetch refspec (or the result of applying
wildcard on one), we always want the RHS to map to something inside
"refs/" hierarchy, so let's spell that rule out in a more explicit way.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Oct 19, 2012
1 parent d9f5ef7 commit 5c08c1f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -1402,8 +1402,8 @@ int get_fetch_map(const struct ref *remote_refs,

for (rmp = &ref_map; *rmp; ) {
if ((*rmp)->peer_ref) {
if (check_refname_format((*rmp)->peer_ref->name + 5,
REFNAME_ALLOW_ONELEVEL)) {
if (prefixcmp((*rmp)->peer_ref->name, "refs/") ||
check_refname_format((*rmp)->peer_ref->name, 0)) {
struct ref *ignore = *rmp;
error("* Ignoring funny ref '%s' locally",
(*rmp)->peer_ref->name);
Expand Down

0 comments on commit 5c08c1f

Please sign in to comment.