mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-25 06:44:59 +00:00
We always want diffs of working-dir + index versus repo #184
This commit is contained in:
parent
af854182dc
commit
589e7eefea
1 changed files with 2 additions and 10 deletions
|
@ -126,19 +126,11 @@ class GitRepo:
|
|||
return commit_message
|
||||
|
||||
def get_diffs(self, pretty, *args):
|
||||
try:
|
||||
commits = self.repo.iter_commits(self.repo.active_branch)
|
||||
current_branch_has_commits = any(commits)
|
||||
except git.exc.GitCommandError:
|
||||
current_branch_has_commits = False
|
||||
|
||||
if not current_branch_has_commits:
|
||||
return ""
|
||||
# we always want diffs of working-dir + index versus repo
|
||||
args = ["--cached"] + list(args)
|
||||
|
||||
if pretty:
|
||||
args = ["--color"] + list(args)
|
||||
if not args:
|
||||
args = ["HEAD"]
|
||||
|
||||
diffs = self.repo.git.diff(*args)
|
||||
return diffs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue