From: Jonathan Nieder Date: Wed, 15 Oct 2014 00:54:21 GMT Subject: [PATCH 21/25] for-each-ref: skip and warn about broken ref names Message-ID: <20141015005421.GY32245@google.com> In-Reply-To: <20141015004522.GD32245@google.com> From: Ronnie Sahlberg Date: Fri, 5 Sep 2014 14:35:17 -0700 Print a warning message for any bad ref names we find in the repo and skip them so callers don't have to deal with parsing them. It might be useful in the future to have a flag where we would not skip these refs for those callers that want to and are prepared (for example by using a --format argument with %0 as a delimiter after the ref name). Signed-off-by: Ronnie Sahlberg Signed-off-by: Jonathan Nieder --- builtin/for-each-ref.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c index 492265d..3ee22b9 100644 --- a/builtin/for-each-ref.c +++ b/builtin/for-each-ref.c @@ -839,6 +839,11 @@ static int grab_single_ref(const char *refname, const unsigned char *sha1, int f struct refinfo *ref; int cnt; + if (flag & REF_BAD_NAME) { + warning("ignoring ref with broken name %s", refname); + return 0; + } + if (*cb->grab_pattern) { const char **pattern; int namelen = strlen(refname); -- 2.1.0.rc2.206.gedb03e5