Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonnie Sahlberg <sahlberg@google.com>2014-09-06 01:35:17 +0400
committerJunio C Hamano <gitster@pobox.com>2014-10-15 21:47:26 +0400
commit971c41c71728d057115b105f427202f98565f933 (patch)
tree77f2f765b39e8ad922305c6785c730074d54409c /builtin/for-each-ref.c
parentd0f810f0bc0d6b51722b400f70c2590713f168e8 (diff)
for-each-ref: skip and warn about broken ref names
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 <sahlberg@google.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/for-each-ref.c')
-rw-r--r--builtin/for-each-ref.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index 492265d9f9c..3ee22b96a56 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);