static boolean isCached(@NonNull Repository repo) { File gitDir = repo.getDirectory(); if (gitDir == null) { return false; } FileKey key = new FileKey(gitDir, repo.getFS()); return cache.cacheMap.get(key) == repo; }
static boolean isCached(@NonNull Repository repo) { File gitDir = repo.getDirectory(); if (gitDir == null) { return false; } FileKey key = new FileKey(gitDir, repo.getFS()); Reference<Repository> repoRef = cache.cacheMap.get(key); return repoRef != null && repoRef.get() == repo; }
static boolean isCached(@NonNull Repository repo) { File gitDir = repo.getDirectory(); if (gitDir == null) { return false; } FileKey key = new FileKey(gitDir, repo.getFS()); return cache.cacheMap.get(key) == repo; }
/** * Obtain a pointer to a location on disk. * <p> * The method performs some basic guessing to locate the repository. * Searched paths are: * <ol> * <li>{@code directory} // assume exact match</li> * <li>{@code directory} + "/.git" // assume working directory</li> * <li>{@code directory} + ".git" // assume bare</li> * </ol> * * @param directory * location where the repository database might be. * @param fs * the file system abstraction which will be necessary to * perform certain file system operations. * @return a key for the given directory. * @see #exact(File, FS) */ public static FileKey lenient(final File directory, FS fs) { final File gitdir = resolve(directory, fs); return new FileKey(gitdir != null ? gitdir : directory, fs); }
/** * Obtain a pointer to a location on disk. * <p> * The method performs some basic guessing to locate the repository. * Searched paths are: * <ol> * <li>{@code directory} // assume exact match</li> * <li>{@code directory} + "/.git" // assume working directory</li> * <li>{@code directory} + ".git" // assume bare</li> * </ol> * * @param directory * location where the repository database might be. * @param fs * the file system abstraction which will be necessary to * perform certain file system operations. * @return a key for the given directory. * @see #exact(File, FS) */ public static FileKey lenient(File directory, FS fs) { final File gitdir = resolve(directory, fs); return new FileKey(gitdir != null ? gitdir : directory, fs); }
/** * Obtain a pointer to an exact location on disk. * <p> * No guessing is performed, the given location is exactly the GIT_DIR * directory of the repository. * * @param directory * location where the repository database is. * @param fs * the file system abstraction which will be necessary to * perform certain file system operations. * @return a key for the given directory. * @see #lenient(File, FS) */ public static FileKey exact(final File directory, FS fs) { return new FileKey(directory, fs); }
/** * Obtain a pointer to an exact location on disk. * <p> * No guessing is performed, the given location is exactly the GIT_DIR * directory of the repository. * * @param directory * location where the repository database is. * @param fs * the file system abstraction which will be necessary to * perform certain file system operations. * @return a key for the given directory. * @see #lenient(File, FS) */ public static FileKey exact(File directory, FS fs) { return new FileKey(directory, fs); }
/** * Obtain a pointer to a location on disk. * <p> * The method performs some basic guessing to locate the repository. * Searched paths are: * <ol> * <li>{@code directory} // assume exact match</li> * <li>{@code directory} + "/.git" // assume working directory</li> * <li>{@code directory} + ".git" // assume bare</li> * </ol> * * @param directory * location where the repository database might be. * @param fs * the file system abstraction which will be necessary to * perform certain file system operations. * @return a key for the given directory. * @see #exact(File, FS) */ public static FileKey lenient(File directory, FS fs) { final File gitdir = resolve(directory, fs); return new FileKey(gitdir != null ? gitdir : directory, fs); }
/** * Obtain a pointer to an exact location on disk. * <p> * No guessing is performed, the given location is exactly the GIT_DIR * directory of the repository. * * @param directory * location where the repository database is. * @param fs * the file system abstraction which will be necessary to * perform certain file system operations. * @return a key for the given directory. * @see #lenient(File, FS) */ public static FileKey exact(File directory, FS fs) { return new FileKey(directory, fs); }