/** * Guess if a directory contains a Git repository. * <p> * This method guesses by looking for the existence of some key files * and directories. * * @param dir * the location of the directory to examine. * @param fs * the file system abstraction which will be necessary to * perform certain file system operations. * @return true if the directory "looks like" a Git repository; false if * it doesn't look enough like a Git directory to really be a * Git directory. */ public static boolean isGitRepository(File dir, FS fs) { return fs.resolve(dir, "objects").exists() //$NON-NLS-1$ && fs.resolve(dir, "refs").exists() //$NON-NLS-1$ && isValidHead(new File(dir, Constants.HEAD)); }
/** * Guess if a directory contains a Git repository. * <p> * This method guesses by looking for the existence of some key files * and directories. * * @param dir * the location of the directory to examine. * @param fs * the file system abstraction which will be necessary to * perform certain file system operations. * @return true if the directory "looks like" a Git repository; false if * it doesn't look enough like a Git directory to really be a * Git directory. */ public static boolean isGitRepository(final File dir, FS fs) { return fs.resolve(dir, "objects").exists() //$NON-NLS-1$ && fs.resolve(dir, "refs").exists() //$NON-NLS-1$ && isValidHead(new File(dir, Constants.HEAD)); }
/** * Guess if a directory contains a Git repository. * <p> * This method guesses by looking for the existence of some key files * and directories. * * @param dir * the location of the directory to examine. * @param fs * the file system abstraction which will be necessary to * perform certain file system operations. * @return true if the directory "looks like" a Git repository; false if * it doesn't look enough like a Git directory to really be a * Git directory. */ public static boolean isGitRepository(File dir, FS fs) { return fs.resolve(dir, "objects").exists() //$NON-NLS-1$ && fs.resolve(dir, "refs").exists() //$NON-NLS-1$ && isValidHead(new File(dir, Constants.HEAD)); }