]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'es/blame-L-more'
authorJunio C Hamano <gitster@pobox.com>
Mon, 9 Sep 2013 21:32:45 +0000 (14:32 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 9 Sep 2013 21:32:45 +0000 (14:32 -0700)
More fixes to the code to parse the "-L" option in "log" and "blame".

* es/blame-L-more:
  blame: reject empty ranges -L,+0 and -L,-0
  t8001/t8002: blame: demonstrate acceptance of bogus -L,+0 and -L,-0
  blame: reject empty ranges -LX,+0 and -LX,-0
  t8001/t8002: blame: demonstrate acceptance of bogus -LX,+0 and -LX,-0
  log: fix -L bounds checking bug
  t4211: retire soon-to-be unimplementable tests
  t4211: log: demonstrate -L bounds checking bug
  blame: fix -L bounds checking bug
  t8001/t8002: blame: add empty file & partial-line tests
  t8001/t8002: blame: demonstrate -L bounds checking bug
  t8001/t8002: blame: decompose overly-large test

1  2 
builtin/blame.c

diff --combined builtin/blame.c
index f932112e72f42fcfcb418109ecd7c08c3522d4f5,e70b089a67d4c4b87663faebd788c437c1f1ce73..aa1abb6d5e19ed60197a477a8b4bafa6fbd20c76
@@@ -2273,10 -2273,10 +2273,10 @@@ int cmd_blame(int argc, const char **ar
        static const char *revs_file = NULL;
        static const char *contents_from = NULL;
        static const struct option options[] = {
 -              OPT_BOOLEAN(0, "incremental", &incremental, N_("Show blame entries as we find them, incrementally")),
 -              OPT_BOOLEAN('b', NULL, &blank_boundary, N_("Show blank SHA-1 for boundary commits (Default: off)")),
 -              OPT_BOOLEAN(0, "root", &show_root, N_("Do not treat root commits as boundaries (Default: off)")),
 -              OPT_BOOLEAN(0, "show-stats", &show_stats, N_("Show work cost statistics")),
 +              OPT_BOOL(0, "incremental", &incremental, N_("Show blame entries as we find them, incrementally")),
 +              OPT_BOOL('b', NULL, &blank_boundary, N_("Show blank SHA-1 for boundary commits (Default: off)")),
 +              OPT_BOOL(0, "root", &show_root, N_("Do not treat root commits as boundaries (Default: off)")),
 +              OPT_BOOL(0, "show-stats", &show_stats, N_("Show work cost statistics")),
                OPT_BIT(0, "score-debug", &output_option, N_("Show output score for blame entries"), OUTPUT_SHOW_SCORE),
                OPT_BIT('f', "show-name", &output_option, N_("Show original filename (Default: auto)"), OUTPUT_SHOW_NAME),
                OPT_BIT('n', "show-number", &output_option, N_("Show original linenumber (Default: off)"), OUTPUT_SHOW_NUMBER),
@@@ -2495,13 -2495,13 +2495,13 @@@ parse_done
        bottom = top = 0;
        if (bottomtop)
                prepare_blame_range(&sb, bottomtop, lno, &bottom, &top);
+       if (lno < top || ((lno || bottom) && lno < bottom))
+               die("file %s has only %lu lines", path, lno);
        if (bottom < 1)
                bottom = 1;
        if (top < 1)
                top = lno;
        bottom--;
-       if (lno < top || lno < bottom)
-               die("file %s has only %lu lines", path, lno);
  
        ent = xcalloc(1, sizeof(*ent));
        ent->lno = bottom;