"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/git-repository-provider.js" between
atom-1.42.0.tar.gz and atom-1.43.0.tar.gz

About: Atom is a modern, approachable, yet hackable text editor.

git-repository-provider.js  (atom-1.42.0):git-repository-provider.js  (atom-1.43.0)
skipping to change at line 102 skipping to change at line 102
} }
// Returns a boolean indicating whether the specified directory represents a Git // Returns a boolean indicating whether the specified directory represents a Git
// repository. // repository.
// //
// * `directory` {Directory} whose base name is `.git`. // * `directory` {Directory} whose base name is `.git`.
function isValidGitDirectorySync(directory) { function isValidGitDirectorySync(directory) {
// To decide whether a directory has a valid .git folder, we use // To decide whether a directory has a valid .git folder, we use
// the heuristic adopted by the valid_repository_path() function defined in // the heuristic adopted by the valid_repository_path() function defined in
// node_modules/git-utils/deps/libgit2/src/repository.c. // node_modules/git-utils/deps/libgit2/src/repository.c.
const commonDirFile = directory.getSubdirectory('commondir');
let commonDir;
if (commonDirFile.existsSync()) {
const commonDirPathBuff = fs.readFileSync(commonDirFile.getPath());
const commonDirPathString = commonDirPathBuff.toString().trim();
commonDir = new Directory(directory.resolve(commonDirPathString));
if (!commonDir.existsSync()) {
return false;
}
} else {
commonDir = directory;
}
return ( return (
directory.getSubdirectory('objects').existsSync() &&
directory.getFile('HEAD').existsSync() && directory.getFile('HEAD').existsSync() &&
directory.getSubdirectory('refs').existsSync() commonDir.getSubdirectory('objects').existsSync() &&
commonDir.getSubdirectory('refs').existsSync()
); );
} }
// Returns a {Promise} that resolves to a {Boolean} indicating whether the // Returns a {Promise} that resolves to a {Boolean} indicating whether the
// specified directory represents a Git repository. // specified directory represents a Git repository.
// //
// * `directory` {Directory} whose base name is `.git`. // * `directory` {Directory} whose base name is `.git`.
async function isValidGitDirectory(directory) { async function isValidGitDirectory(directory) {
// To decide whether a directory has a valid .git folder, we use // To decide whether a directory has a valid .git folder, we use
// the heuristic adopted by the valid_repository_path() function defined in // the heuristic adopted by the valid_repository_path() function defined in
// node_modules/git-utils/deps/libgit2/src/repository.c. // node_modules/git-utils/deps/libgit2/src/repository.c.
const commonDirFile = directory.getSubdirectory('commondir');
let commonDir;
if (await commonDirFile.exists()) {
const commonDirPathBuff = await fs.readFile(commonDirFile.getPath());
const commonDirPathString = commonDirPathBuff.toString().trim();
commonDir = new Directory(directory.resolve(commonDirPathString));
if (!(await commonDir.exists())) {
return false;
}
} else {
commonDir = directory;
}
return ( return (
(await directory.getSubdirectory('objects').exists()) &&
(await directory.getFile('HEAD').exists()) && (await directory.getFile('HEAD').exists()) &&
directory.getSubdirectory('refs').exists() (await commonDir.getSubdirectory('objects').exists()) &&
commonDir.getSubdirectory('refs').exists()
); );
} }
// Provider that conforms to the atom.repository-provider@0.1.0 service. // Provider that conforms to the atom.repository-provider@0.1.0 service.
class GitRepositoryProvider { class GitRepositoryProvider {
constructor(project, config) { constructor(project, config) {
// Keys are real paths that end in `.git`. // Keys are real paths that end in `.git`.
// Values are the corresponding GitRepository objects. // Values are the corresponding GitRepository objects.
this.project = project; this.project = project;
this.config = config; this.config = config;
 End of changes. 6 change blocks. 
4 lines changed or deleted 28 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)