public static File resolve(File directory, FS fs) {if (isGitRepository(directory, fs))return directory;if (isGitRepository(new File(directory, Constants.DOT_GIT), fs))return new File(directory, Constants.DOT_GIT);final String name = directory.getName();final File parent = directory.getParentFile();if (isGitRepository(new File(parent, name + Constants.DOT_GIT_EXT), fs))return new File(parent, name + Constants.DOT_GIT_EXT);return null;}

public static File resolve ( File directory , FS fs ) { if ( isGitRepository ( directory , fs ) ) return directory ; if ( isGitRepository ( new File ( directory , Constants . DOT_GIT ) , fs ) ) return new File ( directory , Constants . DOT_GIT ) ; final String name = directory . getName ( ) ; final File parent = directory . getParentFile ( ) ; if ( isGitRepository ( new File ( parent , name + Constants . DOT_GIT_EXT ) , fs ) ) return new File ( parent , name + Constants . DOT_GIT_EXT ) ; return null ; }
public static FilePath Resolve(FilePath directory, FS fs){if (IsGitRepository(directory, fs)){return directory;}if (IsGitRepository(new FilePath(directory, Constants.DOT_GIT), fs)){return new FilePath(directory, Constants.DOT_GIT);}string name = directory.GetName();FilePath parent = directory.GetParentFile();if (IsGitRepository(new FilePath(parent, name + Constants.DOT_GIT_EXT), fs)){return new FilePath(parent, name + Constants.DOT_GIT_EXT);}return null;}
