From 3cc9a4d495afa80795222848b1f3941dd539f63d Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Wed, 14 Jun 2006 21:38:03 +0200 Subject: [PATCH] Allow strings to be enclosed in either ' or " So now you can use both: set commit-encoding = "UTF-8" set commit-encoding = 'UTF-8' set commit-encoding = UTF-8 --- tig.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tig.c b/tig.c index cda8a71..a3b92c8 100644 --- a/tig.c +++ b/tig.c @@ -946,8 +946,22 @@ option_set_command(int argc, char *argv[]) } if (!strcmp(argv[0], "commit-encoding")) { - string_copy(opt_encoding, argv[2]); - return OK; + char *arg = argv[2]; + int delimiter = *arg; + int i; + + switch (delimiter) { + case '"': + case '\'': + for (arg++, i = 0; arg[i]; i++) + if (arg[i] == delimiter) { + arg[i] = 0; + break; + } + default: + string_copy(opt_encoding, arg); + return OK; + } } config_msg = "Unknown variable name"; -- 2.30.2