mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-25 14:55:00 +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
|
return commit_message
|
||||||
|
|
||||||
def get_diffs(self, pretty, *args):
|
def get_diffs(self, pretty, *args):
|
||||||
try:
|
# we always want diffs of working-dir + index versus repo
|
||||||
commits = self.repo.iter_commits(self.repo.active_branch)
|
args = ["--cached"] + list(args)
|
||||||
current_branch_has_commits = any(commits)
|
|
||||||
except git.exc.GitCommandError:
|
|
||||||
current_branch_has_commits = False
|
|
||||||
|
|
||||||
if not current_branch_has_commits:
|
|
||||||
return ""
|
|
||||||
|
|
||||||
if pretty:
|
if pretty:
|
||||||
args = ["--color"] + list(args)
|
args = ["--color"] + list(args)
|
||||||
if not args:
|
|
||||||
args = ["HEAD"]
|
|
||||||
|
|
||||||
diffs = self.repo.git.diff(*args)
|
diffs = self.repo.git.diff(*args)
|
||||||
return diffs
|
return diffs
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue