Merge branch 'ab/test-must-be-empty'
[gitweb.git] / builtin / blame.c
index 921d127f29257facb5942e7b03304a69bafff175..97f6ecaf370dfdda1f0a9e5a1fe824a034fdbf61 100644 (file)
@@ -410,7 +410,7 @@ static void parse_color_fields(const char *s)
        }
 
        if (next == EXPECT_COLOR)
-               die (_("must end with a color"));
+               die(_("must end with a color"));
 
        colorfield[colorfield_nr].hop = TIME_MAX;
        string_list_clear(&l, 0);
@@ -1002,13 +1002,13 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
                                    nth_line_cb, &sb, lno, anchor,
                                    &bottom, &top, sb.path))
                        usage(blame_usage);
-               if (lno < top || ((lno || bottom) && lno < bottom))
+               if ((!lno && (top || bottom)) || lno < bottom)
                        die(Q_("file %s has only %lu line",
                               "file %s has only %lu lines",
                               lno), path, lno);
                if (bottom < 1)
                        bottom = 1;
-               if (top < 1)
+               if (top < 1 || lno < top)
                        top = lno;
                bottom--;
                range_set_append_unsafe(&ranges, bottom, top);
@@ -1071,7 +1071,9 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
                find_alignment(&sb, &output_option);
                if (!*repeated_meta_color &&
                    (output_option & OUTPUT_COLOR_LINE))
-                       strcpy(repeated_meta_color, GIT_COLOR_CYAN);
+                       xsnprintf(repeated_meta_color,
+                                 sizeof(repeated_meta_color),
+                                 "%s", GIT_COLOR_CYAN);
        }
        if (output_option & OUTPUT_ANNOTATE_COMPAT)
                output_option &= ~(OUTPUT_COLOR_LINE | OUTPUT_SHOW_AGE_WITH_COLOR);