Skip to content

Loading…

Please merge sh/next into master #9

Merged
merged 2 commits into from

2 participants

@tokkee

Hi,

these commits fix the following issues:

  • coloring lines in merge commit diffs
  • integer parsing (use the right constant when checking the return value)

Cheers,
Sebastian

tokkee added some commits
@tokkee tokkee Colorize merge commit diffs as well
Signed-off-by: Sebastian Harl <sh@tokkee.org>
2654e60
@tokkee tokkee Use error codes when checking parse_int() return value
Usually, OPT_OK != OK, so we'd usually treat success as an error, leading e.g.
to errors like "Unable to parse '42' as a line number".

Reported by Christian Ohm in Debian bug #626124.

Signed-off-by: Sebastian Harl <sh@tokkee.org>
f2c5255
@jonas jonas merged commit cc3ca7c into jonas:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 9, 2011
  1. @tokkee

    Colorize merge commit diffs as well

    tokkee committed
    Signed-off-by: Sebastian Harl <sh@tokkee.org>
  2. @tokkee

    Use error codes when checking parse_int() return value

    tokkee committed
    Usually, OPT_OK != OK, so we'd usually treat success as an error, leading e.g.
    to errors like "Unable to parse '42' as a line number".
    
    Reported by Christian Ohm in Debian bug #626124.
    
    Signed-off-by: Sebastian Harl <sh@tokkee.org>
Showing with 4 additions and 2 deletions.
  1. +4 −2 tig.c
View
6 tig.c
@@ -391,7 +391,9 @@ static const char **opt_blame_argv = NULL;
LINE(DIFF_HEADER, "diff --git ", COLOR_YELLOW, COLOR_DEFAULT, 0), \
LINE(DIFF_CHUNK, "@@", COLOR_MAGENTA, COLOR_DEFAULT, 0), \
LINE(DIFF_ADD, "+", COLOR_GREEN, COLOR_DEFAULT, 0), \
+LINE(DIFF_ADD2, " +", COLOR_GREEN, COLOR_DEFAULT, 0), \
LINE(DIFF_DEL, "-", COLOR_RED, COLOR_DEFAULT, 0), \
+LINE(DIFF_DEL2, " -", COLOR_RED, COLOR_DEFAULT, 0), \
LINE(DIFF_INDEX, "index ", COLOR_BLUE, COLOR_DEFAULT, 0), \
LINE(DIFF_OLDMODE, "old file mode ", COLOR_YELLOW, COLOR_DEFAULT, 0), \
LINE(DIFF_NEWMODE, "new file mode ", COLOR_YELLOW, COLOR_DEFAULT, 0), \
@@ -1027,7 +1029,7 @@ set_color(int *color, const char *name)
if (map_enum(color, color_map, name))
return TRUE;
if (!prefixcmp(name, "color"))
- return parse_int(color, name + 5, 0, 255) == OK;
+ return parse_int(color, name + 5, 0, 255) == OPT_OK;
return FALSE;
}
@@ -6914,7 +6916,7 @@ main(int argc, const char *argv[])
if (cmd && isdigit(*cmd)) {
int lineno = view->lineno + 1;
- if (parse_int(&lineno, cmd, 1, view->lines + 1) == OK) {
+ if (parse_int(&lineno, cmd, 1, view->lines + 1) == OPT_OK) {
select_view_line(view, lineno - 1);
report("");
} else {
Something went wrong with that request. Please try again.