From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Cc: Michael Haggerty <mhagger@alum.mit.edu>
Subject: [PATCH 2/2] get_fetch_map(): tighten checks on dest refs
Date: Mon, 20 Aug 2012 10:39:57 -0700 [thread overview]
Message-ID: <1345484397-10958-3-git-send-email-gitster@pobox.com> (raw)
In-Reply-To: <1345484397-10958-1-git-send-email-gitster@pobox.com>
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>
---
remote.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/remote.c b/remote.c
index eacd8ad..0f2b1db 100644
--- a/remote.c
+++ b/remote.c
@@ -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);
--
1.7.12.92.g7963261
prev parent reply other threads:[~2012-08-20 17:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-20 17:39 [PATCH 0/2] further fixes of check_ref_format() users Junio C Hamano
2012-08-20 17:39 ` [PATCH 1/2] fetch/push: allow refs/*:refs/* Junio C Hamano
2012-08-21 6:43 ` Michael Haggerty
2012-08-21 17:37 ` Junio C Hamano
2012-08-22 7:39 ` Michael Haggerty
2012-08-22 11:28 ` Junio C Hamano
2012-08-22 16:56 ` Junio C Hamano
2012-08-20 17:39 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1345484397-10958-3-git-send-email-gitster@pobox.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=mhagger@alum.mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.