bisect-kit: make git_util.list_commits_between_commits faster
Simply early return for a trivial case.
On a machine with slow disk io, this change could reduce
bisect_cr_localbuild_internal.py init time from 55 to 41 minutes.
BUG=b:157446351
TEST=./bisect_cr_localbuild_internal.py init --old 84.0.4142.0 --new 84.0.4147.0
Change-Id: I5f2330d179086df8f7e0d91ebe4c9d90fea2c1c8
diff --git a/bisect_kit/git_util.py b/bisect_kit/git_util.py
index 1d565d7..13954c9 100644
--- a/bisect_kit/git_util.py
+++ b/bisect_kit/git_util.py
@@ -718,7 +718,10 @@
list of (timestamp, rev)
"""
assert old and new
- assert old == new or is_ancestor_commit(git_repo, old, new)
+ if old == new:
+ return []
+
+ assert is_ancestor_commit(git_repo, old, new)
commits = []
# --first-parent is necessary for Android, see following link for more
# discussion.