Search the path where git is installed on Windows.

@return string Empty string if not found
341366
private function findWindowsGitFolder()
    {
        list($rc, $stdOut) = $this->run('where git.exe');
        if ($rc !== 0) {
            return '';
        }
        $stdOut = str_replace("\r\n", "\n", $stdOut);
        foreach (explode("\n", trim($stdOut)) as $path) {
            $easierPath = str_replace('\\', '/', $path);
            $match = null;
            if (preg_match('_^(.+)/(?:cmd|bin)/git\.exe$_i', $easierPath, $match)) {
                return str_replace('/', '\\', $match[1]);
            }
        }

        return '';
    }
1233021
def get_vcs_directory(context, directory):
        """"""
        nested = os.path.join(directory, '.git')
        return nested if context.is_directory(nested) else directory
477354
protected static function checkVersion()
    {
        if (self::$checked === true) {
            return true;
        }

        $process = new \SystemProcess\SystemProcess('git');
        $process->nonZeroExitCodeException = true;
        $process->argument('--version')->execute();

        if (!preg_match('(\\d+(?:\.\\d+)+)', $process->stdoutOutput, $match)) {
            throw new \RuntimeException('Could not determine GIT version.');
        }

        if (version_compare($match[0], '1.6', '>=')) {
            return self::$checked = true;
        }

        throw new \RuntimeException('Git is required in a minimum version of 1.6.');
    }
161893
private function findGitDirectories() : array
    {
        $finderGit = $this->finderFactory->build();
        $finderGit->in($this->environment->getRootDirectory())->depth('> 0')->path('/.git$/');
        $rawExcludePathsByFileByGit = $this->finderToRealPathConverter->finderToArrayOfPaths($finderGit);
        return array_map('dirname', $rawExcludePathsByFileByGit);
    }
1108069
function (options) {
  var git_repo_path = ((options && options['gcwd']) || process.cwd()) + '/.git';

  return fs.statAsync(git_repo_path)
    .call('isDirectory')
    .then(function (exist) {
      return exist && git_repo_path
    })
}
861402
def _git_version():
    """"""

    import subprocess
    import os

    def _minimal_ext_cmd(cmd):
        # construct minimal environment
        env = {}
        for k in ['SYSTEMROOT', 'PATH']:
            v = os.environ.get(k)
            if v is not None:
                env[k] = v
        # LANGUAGE is used on win32
        env['LANGUAGE'] = 'C'
        env['LANG'] = 'C'
        env['LC_ALL'] = 'C'
        FNULL = open(os.devnull, 'w')
        cwd = os.path.dirname(os.path.realpath(__file__))
        proc = subprocess.Popen(
            cmd, stdout=subprocess.PIPE, stderr=FNULL, env=env, cwd=cwd)
        out = proc.communicate()[0]
        return out

    try:
        out = _minimal_ext_cmd(['git', 'rev-parse', 'HEAD'])
        return out.strip().decode('ascii')
    except OSError:
        return "unknown"
1229340
def __get_git_bin():
    
    git = 'git'
    alternatives = [
        '/usr/bin/git'
    ]
    for alt in alternatives:
        if os.path.exists(alt):
            git = alt
            break
    return git
438691
public function getBuildPath()
    {
        $path = pathinfo($this->relativePath);

        $fingerprint = md5($this->filters->map(function($f) { return $f->getFilter(); })->toJson().$this->getLastModified());

        return "{$path['dirname']}/{$path['filename']}-{$fingerprint}.{$this->getBuildExtension()}";
    }
227607
public function findChangedByGit(): ?\Generator
    {
        // -u expand dir's files
        [, $output,] = Sys::run('git status -s -u', $this->basePath);

        // 'D some.file'    deleted
        // ' M some.file'   modified
        // '?? some.file'   new file
        foreach (\explode("\n", \trim($output)) as $file) {
            $file = \trim($file);

            // only php file.
            if (!\strpos($file, '.php')) {
                continue;
            }

            // modified files
            if (\strpos($file, 'M ') === 0) {
                yield \substr($file, 2);

                // new files
            } elseif (\strpos($file, '?? ') === 0) {
                yield \substr($file, 3);
            }
        }
    }
553018
def find_git_dir(path)
      path = Pathname.new(path).realpath
      while path.parent != path && !(path + ".git").directory?
        path = path.parent
      end
      
      path = path + ".git"
      
      raise "Could not find suitable .git dir in #{path}" if !path.directory?

      path
    end
1247312
protected static function retrieveInstallPath()
    {
        $path1 = DIRECTORY_SEPARATOR.implode(
                DIRECTORY_SEPARATOR,
                array('src', 'Doozr', 'Installer', 'Base.php')
            );

        $path2 = DIRECTORY_SEPARATOR.implode(
                DIRECTORY_SEPARATOR,
                array('vendor', 'clickalicious', 'doozr')
            );

        $path = str_replace($path1, '', __FILE__);
        $path = str_replace($path2, '', $path);

        return realpath($path);
    }
507718
public function installViaGit()
    {
        return new Process(sprintf(
            'cd %s && git clone %s %s && cd %s && git checkout %s',
            base_path(),
            $this->getRepoUrl(),
            $this->getDestinationPath(),
            $this->getDestinationPath(),
            $this->getBranch()
        ));
    }
895765
protected function getGitCommand(): string
    {
        return 'diff' . $this->ignoreWhitespaces . $this->ignoreEOL . $this->stats . ' ' . $this->compare;
    }
1341242
def find_file(path, tgt_env='base', **kwargs):  # pylint: disable=W0613
    '''
    
    '''
    return _gitfs().find_file(path, tgt_env=tgt_env, **kwargs)
895422
public function getRelativeProjectPath(string $path): string
    {
        $realPath = $this->getAbsolutePath($path);
        $gitPath = $this->getAbsolutePath($this->getGitDir());

        if (0 !== strpos($realPath, $gitPath)) {
            return $realPath;
        }

        return rtrim($this->getRelativePath($realPath), '\\/');
    }
156177
public function getPathInfo()
	{
		$path = trim($this->uri->getPath(false), '/');
		
		if($this->pathBase == '')
		{
			return $path;
		}
		
		if($path == $this->pathBase)
		{
			return '';
		}
		
		return preg_replace("'^" . preg_quote($this->pathBase, "'") . "/'i", '', $path);
	}
1248364
private int installGit(){
        int resultOfCommand;
        log.info("Installing git {}", new Object[]{this});
        resultOfCommand = getMachine().execCommands("install Git", ImmutableList.of("sudo apt-get -y install git"));
        if(resultOfCommand!=0)
            log.warn("Installing problem installing result {}", resultOfCommand);
        return resultOfCommand;
    }