X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-for-each-ref.c;h=16c785f0477f2688632f3b67e39083f60e48b2db;hb=fd2a75972e90d34bc8d4bebe1d669645557a2192;hp=173bf38735315a1c299f1f2e3db76a7795a2305c;hpb=d0a75a179e0e872c47d4a25350565a8c7c04dd0b;p=git.git diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c index 173bf3873..16c785f04 100644 --- a/builtin-for-each-ref.c +++ b/builtin-for-each-ref.c @@ -6,13 +6,13 @@ #include "tree.h" #include "blob.h" #include "quote.h" -#include /* Quoting styles */ #define QUOTE_NONE 0 #define QUOTE_SHELL 1 #define QUOTE_PERL 2 #define QUOTE_PYTHON 3 +#define QUOTE_TCL 4 typedef enum { FIELD_STR, FIELD_ULONG, FIELD_TIME } cmp_type; @@ -135,7 +135,7 @@ static const char *find_next(const char *cp) while (*cp) { if (*cp == '%') { /* %( is the start of an atom; - * %% is a quoteed per-cent. + * %% is a quoted per-cent. */ if (cp[1] == '(') return cp; @@ -478,9 +478,9 @@ static void grab_sub_body_contents(struct atom_value *val, int deref, struct obj if (!strcmp(name, "subject")) v->s = copy_line(subpos); else if (!strcmp(name, "body")) - v->s = bodypos; + v->s = xstrdup(bodypos); else if (!strcmp(name, "contents")) - v->s = subpos; + v->s = xstrdup(subpos); } } @@ -724,6 +724,9 @@ static void print_value(struct refinfo *ref, int atom, int quote_style) case QUOTE_PYTHON: python_quote_print(stdout, v->s); break; + case QUOTE_TCL: + tcl_quote_print(stdout, v->s); + break; } } @@ -835,6 +838,12 @@ int cmd_for_each_ref(int ac, const char **av, char *prefix) quote_style = QUOTE_PYTHON; continue; } + if (!strcmp(arg, "--tcl") ) { + if (0 <= quote_style) + die("more than one quoting style?"); + quote_style = QUOTE_TCL; + continue; + } if (!strncmp(arg, "--count=", 8)) { if (maxcount) die("more than one --count?");