Skip to content

Commit 2a72d73

Browse files
committed
Add comments for clarity in git_diff_context
1 parent 55c92ef commit 2a72d73

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

aicodebot/helpers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ def git_diff_context(commit=None):
1414
base_git_diff = ["git", "diff", "-U10"] # Tell diff to provide 10 lines of context
1515

1616
if commit:
17+
# If a commit is provided, just get the diff for that commit
1718
return exec_and_get_output(["git", "show", commit])
1819
else:
20+
# Otherwise, get the diff for the staged files, or if there are none, the diff for the unstaged files
1921
staged_files = exec_and_get_output(["git", "diff", "--cached", "--name-only"]).splitlines()
2022
if staged_files:
2123
# If there are staged files, get the diff for those files

0 commit comments

Comments
 (0)