Merge branch 'nd/magic-pathspec'
[gitweb.git] / builtin / for-each-ref.c
index 7f059c31dfbd11f77c891134ccc34cdc1f65bcb8..1d4083c2ddef07c6488d36720e6a0c48b04c6585 100644 (file)
@@ -867,24 +867,29 @@ static void sort_refs(struct ref_sort *sort, struct refinfo **refs, int num_refs
 static void print_value(struct refinfo *ref, int atom, int quote_style)
 {
        struct atom_value *v;
+       struct strbuf sb = STRBUF_INIT;
        get_value(ref, atom, &v);
        switch (quote_style) {
        case QUOTE_NONE:
                fputs(v->s, stdout);
                break;
        case QUOTE_SHELL:
-               sq_quote_print(stdout, v->s);
+               sq_quote_buf(&sb, v->s);
                break;
        case QUOTE_PERL:
-               perl_quote_print(stdout, v->s);
+               perl_quote_buf(&sb, v->s);
                break;
        case QUOTE_PYTHON:
-               python_quote_print(stdout, v->s);
+               python_quote_buf(&sb, v->s);
                break;
        case QUOTE_TCL:
-               tcl_quote_print(stdout, v->s);
+               tcl_quote_buf(&sb, v->s);
                break;
        }
+       if (quote_style != QUOTE_NONE) {
+               fputs(sb.buf, stdout);
+               strbuf_release(&sb);
+       }
 }
 
 static int hex1(char ch)