diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2007-01-28 02:39:13 -0500 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-01-28 13:00:26 -0800 |
commit | 5558e55c06a1e897f3064f0c8a343d5c9858f6b2 (patch) | |
tree | 7bc79784574ecdba84ff23a67ea7263f88f86240 /builtin-for-each-ref.c | |
parent | cace16fdcb5d1a3518f92e04c65e78f06b0cd051 (diff) | |
download | git-5558e55c06a1e897f3064f0c8a343d5c9858f6b2.tar.gz |
Teach for-each-ref about a little language called Tcl.
Love it or hate it, some people actually still program in Tcl. Some
of those programs are meant for interfacing with Git. Programs such as
gitk and git-gui. It may be useful to have Tcl-safe output available
from for-each-ref, just like shell, Perl and Python already enjoy.
Thanks to Sergey Vlasov for pointing out the horrible flaws in the
first and second version of this patch, and steering me in the right
direction for Tcl value quoting.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-for-each-ref.c')
-rw-r--r-- | builtin-for-each-ref.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c index af72a12a57..9d5f266dc4 100644 --- a/builtin-for-each-ref.c +++ b/builtin-for-each-ref.c @@ -12,6 +12,7 @@ #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; @@ -723,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; } } @@ -834,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?"); |