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 Jan 27, 2024
1 parent 5e7d213 commit a198d7a
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 @@ -1201,7 +1201,7 @@ def run_async(self):
"sync": True
})

class SelectInlineDiffCommitCommand(WindowCommand):
class SelectInlineDiffCommitCommand(WindowCommand, GitCommand):
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 @@ -1221,7 +1221,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 @@ -1242,8 +1242,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()
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 a198d7a

Please sign in to comment.