Skip to content

git.py: Make is_dir() work for submodule directories (v2)

Change is_dir() to use git rev-parse --is-inside-work-tree. This
is better than the prior implementation because 1) git should know
best what is a git checkout and 2) it works for submodules directories
(which the old implementation did not).

The revised implementation is different than the old one when it comes
to a directory below the root of a git checkout. The new
implementation will return True where the old would return False.

Added a test case for passing a non-existent directory and an empty
directory to is_dir().

Bug: T366810


Related MRs:

Edited by Ahmon Dancy

Merge request reports