Skip to content

Commit 0104ab2

Browse files
committed
Show a dialog after exhausting [Prev] possibilities
1 parent a12a6eb commit 0104ab2

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/blame.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ def run(self, edit, sha_skip_list=[], prevving=False):
2222
if not view_is_suitable(self.view):
2323
return
2424

25-
# The contents of PhantomSet are replaced each time this Command is ran.
2625
phantoms = []
2726

2827
for region in self.view.sel():
@@ -47,6 +46,16 @@ def run(self, edit, sha_skip_list=[], prevving=False):
4746
return
4847

4948
sha, user, date, time = self.parse_blame(blame_output)
49+
# The SHA output by `git blame` may have a leading caret to indicate that it
50+
# is a "boundary commit". That needs to be stripped before passing the SHA
51+
# back to git CLI commands for other purposes.
52+
sha_normalised = sha.strip("^")
53+
54+
if sha_skip_list:
55+
recently_skipped_sha = sha_skip_list[-1]
56+
if sha_normalised == recently_skipped_sha:
57+
sublime.message_dialog("No earlier commits affected this line")
58+
return
5059

5160
phantoms.append(
5261
sublime.Phantom(
@@ -57,10 +66,7 @@ def run(self, edit, sha_skip_list=[], prevving=False):
5766
user=user,
5867
date=date,
5968
time=time,
60-
# The SHA output by `git blame` may have a leading caret to indicate
61-
# that it is a "boundary commit". That needs to be stripped before
62-
# using the SHA programmatically for other purposes.
63-
qs_sha_val=quote_plus(sha.strip("^")),
69+
qs_sha_val=quote_plus(sha_normalised),
6470
# Querystrings can contain the same key multiple times. We use that
6571
# functionality to accumulate a list of SHAs to skip over when
6672
# a [Prev] button has been clicked multiple times.

0 commit comments

Comments
 (0)