Merge branch 'jk/colors'
authorJunio C Hamano <gitster@pobox.com>
Tue, 20 Jan 2015 23:57:22 +0000 (15:57 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 20 Jan 2015 23:57:22 +0000 (15:57 -0800)
* jk/colors:
parse_color: fix return value for numeric color values 0-8

color.c
t/t4026-color.sh
diff --git a/color.c b/color.c
index 809b359a42d426d61f0452e89725177eadeb54cb..9027352ad7786746537adea9007bd46f46edbb4e 100644 (file)
--- a/color.c
+++ b/color.c
@@ -112,6 +112,7 @@ static int parse_color(struct color *out, const char *name, int len)
                } else if (val < 8) {
                        out->type = COLOR_ANSI;
                        out->value = val;
+                       return 0;
                } else if (val < 256) {
                        out->type = COLOR_256;
                        out->value = val;
index 267c43bd95c9b7dbbc5991e7312deeb5527a175a..4d20feacfe8b7688c9bfefc43d60ba4f1a6c2cfc 100755 (executable)
@@ -60,6 +60,10 @@ test_expect_success 'absurdly long color specification' '
          "[1;2;4;5;7;22;24;25;27;38;2;255;255;255;48;2;255;255;255m"
 '
 
+test_expect_success '0-7 are aliases for basic ANSI color names' '
+       color "0 7" "[30;47m"
+'
+
 test_expect_success '256 colors' '
        color "254 bold 255" "[1;38;5;254;48;5;255m"
 '