git_hyper_blame: Fix wrong line number on lines changed many times.
This could, in extreme cases, result in a crash due to the wrong line
number being out of bounds of the file line count.
BUG=709831
Change-Id: I08ec75362d49c4a72e7ee9fd489d5f9baa6d31bd
Reviewed-on: https://chromium-review.googlesource.com/472648
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
diff --git a/git_hyper_blame.py b/git_hyper_blame.py
index 8045683..246ccb2 100755
--- a/git_hyper_blame.py
+++ b/git_hyper_blame.py
@@ -312,9 +312,9 @@
newline = parent_blame[lineno_previous - 1]
# Replace the commit and lineno_then, but not the lineno_now or context.
- logging.debug(' replacing with %r', newline)
- line = BlameLine(newline.commit, line.context, lineno_previous,
+ line = BlameLine(newline.commit, line.context, newline.lineno_then,
line.lineno_now, True)
+ logging.debug(' replacing with %r', line)
# If any line has a different filename to the file's current name, turn on
# filename display for the entire blame output.