isGitDir static method

Future<bool> isGitDir()

Checks if current dir is git repository.

The result value is cached after first invocation. However, when the users starts local server and then runs git init this will not update its result. We might change this in the future.

Implementation

static Future<bool> isGitDir() async {
  try {
    final result = await _shell.run('git status');
    _isGitDirectory = result.errText.isEmpty;
  } catch (e) {
    _isGitDirectory = false;
  }
  return _isGitDirectory;
}