Code

Fix handling of quoted strings in the config file
authorSebastian Harl <sh@tokkee.org>
Fri, 13 Feb 2009 13:10:26 +0000 (14:10 +0100)
committerJonas Fonseca <fonseca@diku.dk>
Fri, 13 Feb 2009 13:32:56 +0000 (14:32 +0100)
parse_string() adapts the string length to automatically remove quotation
marks when copying the string. However, when calling string_ncopy_do()
strlen(arg) used to be called again instead of using the adapted value.

This e.g. led to wrong locale settings when using
  set commit-encoding = "UTF-8"
and thus a slightly messed up display.

Thanks to Gerfried Fuchs for reporting this.

Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
NEWS
tig.c

diff --git a/NEWS b/NEWS
index 7927c21bae0e1744d7d013d0ba4b8252a2ab35d1..e52130cb340ed738a176dfd289c5ce7674cc1b79 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,7 @@ Bug fixes:
  - Blame view: fix problem with uninitialized variable.
  - Blame view: use line number information when loading blame for
    specific commit.
+ - Fix handling of quoted strings in the config file.
 
 tig-0.14
 --------
diff --git a/tig.c b/tig.c
index 707209409e8592eadd964ca5b0bb0ccabe186ad4..2b2607bdc9828f6ba4a13db944d78c50e50214c0 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -1470,7 +1470,7 @@ parse_string(char *opt, const char *arg, size_t optsize)
                }
                arg += 1; arglen -= 2;
        default:
-               string_ncopy_do(opt, optsize, arg, strlen(arg));
+               string_ncopy_do(opt, optsize, arg, arglen);
                return OK;
        }
 }