diff: prevent pprint_rename from underrunning input
commitdd281f09b7eab86e4983b37d011cbfb0f593f6b8
authorThomas Rast <trast@student.ethz.ch>
Tue, 26 Feb 2013 20:47:01 +0000 (26 21:47 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 26 Feb 2013 21:01:34 +0000 (26 13:01 -0800)
tree3e1149754a47b97d47407c049d3a1f50fd8f8e1a
parentd020e27fdaeb7d04247cdf5a0ff84d97626d5f5a
diff: prevent pprint_rename from underrunning input

The logic described in d020e27 (diff: Fix rename pretty-print when
suffix and prefix overlap, 2013-02-23) is wrong: The proof in the
comment is valid only if both strings are the same length.  *One* of
old/new can reach a-1 (b-1, resp.) if 'a' is a suffix of 'b' (or vice
versa).

Since the intent was to let the loop run down to the '/' at the end of
the common prefix, fix it by making that distinction explicit: if
there is no prefix, allow no underrun.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c