Skip to content

Commit

Permalink
Fix handling of submodule paths (#4286)
Browse files Browse the repository at this point in the history
* Fix handling of submodule paths

* Improve and shorten message
  • Loading branch information
sanmai-NL authored Nov 20, 2024
1 parent 8ad3e5b commit 5c3534a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions megalinter/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import tempfile
import urllib.parse
from fnmatch import fnmatch
from pathlib import Path
from typing import Any, Optional, Pattern, Sequence

import git
Expand Down Expand Up @@ -314,6 +315,9 @@ def list_updated_files(repo_home):
except git.InvalidGitRepositoryError:
logging.warning("Unable to find git repository to list updated files")
return []
if not Path(repo.git_dir).resolve().is_relative_to(Path(repo_home).resolve()):
logging.warning("Your workspace is not a Git working copy root (e.g., the workspace is inside a submodule)")
return []
changed_files = [item.a_path for item in repo.index.diff(None)]
return changed_files

Expand Down

0 comments on commit 5c3534a

Please sign in to comment.