repo-config: trim white-space before comment
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>
Tue, 2 May 2006 14:58:37 +0000 (16:58 +0200)
committerJunio C Hamano <junkio@cox.net>
Fri, 5 May 2006 21:34:47 +0000 (14:34 -0700)
Earlier, calling

git-repo-config core.hello

on a .git/config like this:

[core]
hello = world ; a comment

would yield "world " (i.e. with a trailing space).

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
(cherry picked from c1aee1fd8d94da9b3c5d2dc1d4264f7e73a58f80 commit)

config.c

index a3e14d76e54e05887545765dabda11b1bc2af748..2cdf5fcab4da22bed4ed19e9f55b8759ccdcd3fb 100644 (file)
--- a/config.c
+++ b/config.c
@@ -60,6 +60,12 @@ static char *parse_value(void)
                        space = 1;
                        continue;
                }
+               if (!quote) {
+                       if (c == ';' || c == '#') {
+                               comment = 1;
+                               continue;
+                       }
+               }
                if (space) {
                        if (len)
                                value[len++] = ' ';
@@ -93,12 +99,6 @@ static char *parse_value(void)
                        quote = 1-quote;
                        continue;
                }
-               if (!quote) {
-                       if (c == ';' || c == '#') {
-                               comment = 1;
-                               continue;
-                       }
-               }
                value[len++] = c;
        }
 }