Skip to content

Commit

Permalink
Fix listing of modified files
Browse files Browse the repository at this point in the history
Consider the merge-base commit as the starting point of diff instead of listing all differences between branches.
  • Loading branch information
vkucera committed Apr 5, 2024
1 parent c13db37 commit 7ad81a1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions megalinter/MegaLinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,10 +773,10 @@ def list_files_git_diff(self):
"HEAD" if default_branch == "HEAD" else f"refs/heads/{default_branch}"
)
local_ref = f"refs/remotes/{default_branch_remote}"
# Try to fetch default_branch from origin, because it'sn't cached locally.
# Try to fetch default_branch from origin, because it isn't cached locally.
repo.git.fetch("origin", f"{remote_ref}:{local_ref}")
# Make git diff to list files (and exclude symlinks)
diff = repo.git.diff(default_branch_remote, name_only=True)
diff = repo.git.diff(f"{default_branch_remote}...", name_only=True)
logging.info(f"Modified files:\n{diff}")
all_files = list()
for diff_line in diff.splitlines():
Expand Down

0 comments on commit 7ad81a1

Please sign in to comment.