oxsecurity / megalinter

🦙 MegaLinter analyzes 50 languages, 22 formats, 21 tooling formats, excessive copy-pastes, spelling mistakes and security issues in your repository sources with a GitHub Action, other CI tools or locally.
https://megalinter.io
GNU Affero General Public License v3.0
1.96k stars 238 forks source link

Fix handling of submodule paths #4286

Closed sanmai-NL closed 2 days ago

sanmai-NL commented 3 days ago

If the workspace directory was a submodule, MegaLinter would consider this a valid Git working copy to detect changed files in. However, the .git directory may not be accessible from within the submodule, e.g., when the submodule was mounted inside a container as subpath, without ../.git.

Proposed Changes

  1. Skip listing updated files when the .git directory is not a descendant of the workspace directory.

Readiness Checklist

Author/Contributor

Reviewing Maintainer

nvuillam commented 3 days ago

@sanmai-NL fix the flake8 issue (line too long) and i'll validate :)

sanmai-NL commented 3 days ago

@nvuillam Should be done. Can be tested by starting a container with the submodule directory bind-mounted to /tmp/lint.

nvuillam commented 2 days ago

@sanmai-NL I don't have expertise in git submodules, but it looks clean so I merged ;)

Please can you confirm it works well with beta version ?