Skip to content

Commit

Permalink
inline_diff.py
Browse files Browse the repository at this point in the history
fix: add GitCommand inheritance
fix: git branches should be git branch
fix: window command needs window active view instead of self.view
fix: get base_commit from git instead of view settings
  • Loading branch information
tai committed Nov 19, 2024
1 parent 3031d2f commit b4f7545
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions core/commands/inline_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ def run_async(self):
"sync": True
})

class SelectInlineDiffCommitCommand(WindowCommand):
class SelectInlineDiffCommitCommand(WindowCommand, GitCommand):

Check failure on line 1220 in core/commands/inline_diff.py

View workflow job for this annotation

GitHub Actions / lint

expected 2 blank lines, found 1
def _on_commits(self):
commit_text_list = self.git('log', '--format="%h %s"', '-n', str(self._last_n_commits)).strip().splitlines()
if not commit_text_list:
Expand All @@ -1237,7 +1237,7 @@ def _on_select_commits(self, _id):
self._on_done(commit_id)

def _on_branches(self):
branches_text_list = self.git("branches").strip().splitlines()
branches_text_list = self.git("branch").strip().splitlines()
if not branches_text_list:
return self._on_cancel()
self._branch_list = []
Expand All @@ -1258,8 +1258,9 @@ def _on_select_branches(self, _id):
def _on_done(self, commit_id):
if not commit_id:
return self._on_cancel()
settings = self.view.settings()
base_commit = settings.get("git_savvy.inline_diff_view.base_commit")
view = self.window.active_view()
settings = view.settings()

Check failure on line 1262 in core/commands/inline_diff.py

View workflow job for this annotation

GitHub Actions / lint

local variable 'settings' is assigned to but never used
base_commit = self.git("rev-parse", "--short", "HEAD").strip().splitlines()[0]
self.window.run_command("gs_inline_diff", {
"cached": self._cached,
"base_commit": base_commit,
Expand Down

0 comments on commit b4f7545

Please sign in to comment.