From 7a429b024ede01a7b9f80f60717ca80f89d2349c Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 22 Sep 2014 11:07:41 -0700 Subject: [PATCH] Use GitRepository rather than Git --- exports/atom.coffee | 2 +- spec/git-spec.coffee | 34 +++++++++++++++++----------------- src/project.coffee | 6 +++--- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/exports/atom.coffee b/exports/atom.coffee index c238e4fa9..15d128cfa 100644 --- a/exports/atom.coffee +++ b/exports/atom.coffee @@ -4,7 +4,7 @@ module.exports = BufferedNodeProcess: require '../src/buffered-node-process' BufferedProcess: require '../src/buffered-process' - GitRepository: require '../src/git' + GitRepository: require '../src/git-repository' Point: Point Range: Range diff --git a/spec/git-spec.coffee b/spec/git-spec.coffee index 2cc0a6239..235ff5c97 100644 --- a/spec/git-spec.coffee +++ b/spec/git-spec.coffee @@ -1,5 +1,5 @@ temp = require 'temp' -Git = require '../src/git' +GitRepository = require '../src/git-repository' fs = require 'fs-plus' path = require 'path' Task = require '../src/task' @@ -10,7 +10,7 @@ copyRepository = -> fs.renameSync(path.join(workingDirPath, 'git.git'), path.join(workingDirPath, '.git')) workingDirPath -describe "Git", -> +fdescribe "GitRepository", -> repo = null beforeEach -> @@ -22,28 +22,28 @@ describe "Git", -> describe "@open(path)", -> it "returns null when no repository is found", -> - expect(Git.open(path.join(temp.dir, 'nogit.txt'))).toBeNull() + expect(GitRepository.open(path.join(temp.dir, 'nogit.txt'))).toBeNull() - describe "new Git(path)", -> + describe "new GitRepository(path)", -> it "throws an exception when no repository is found", -> - expect(-> new Git(path.join(temp.dir, 'nogit.txt'))).toThrow() + expect(-> new GitRepository(path.join(temp.dir, 'nogit.txt'))).toThrow() describe ".getPath()", -> it "returns the repository path for a .git directory path", -> - repo = new Git(path.join(__dirname, 'fixtures', 'git', 'master.git', 'HEAD')) + repo = new GitRepository(path.join(__dirname, 'fixtures', 'git', 'master.git', 'HEAD')) expect(repo.getPath()).toBe path.join(__dirname, 'fixtures', 'git', 'master.git') it "returns the repository path for a repository path", -> - repo = new Git(path.join(__dirname, 'fixtures', 'git', 'master.git')) + repo = new GitRepository(path.join(__dirname, 'fixtures', 'git', 'master.git')) expect(repo.getPath()).toBe path.join(__dirname, 'fixtures', 'git', 'master.git') describe ".isPathIgnored(path)", -> it "returns true for an ignored path", -> - repo = new Git(path.join(__dirname, 'fixtures', 'git', 'ignore.git')) + repo = new GitRepository(path.join(__dirname, 'fixtures', 'git', 'ignore.git')) expect(repo.isPathIgnored('a.txt')).toBeTruthy() it "returns false for a non-ignored path", -> - repo = new Git(path.join(__dirname, 'fixtures', 'git', 'ignore.git')) + repo = new GitRepository(path.join(__dirname, 'fixtures', 'git', 'ignore.git')) expect(repo.isPathIgnored('b.txt')).toBeFalsy() describe ".isPathModified(path)", -> @@ -51,7 +51,7 @@ describe "Git", -> beforeEach -> workingDirPath = copyRepository() - repo = new Git(workingDirPath) + repo = new GitRepository(workingDirPath) filePath = path.join(workingDirPath, 'a.txt') newPath = path.join(workingDirPath, 'new-path.txt') @@ -75,7 +75,7 @@ describe "Git", -> beforeEach -> workingDirPath = copyRepository() - repo = new Git(workingDirPath) + repo = new GitRepository(workingDirPath) filePath = path.join(workingDirPath, 'a.txt') newPath = path.join(workingDirPath, 'new-path.txt') fs.writeFileSync(newPath, "i'm new here") @@ -92,7 +92,7 @@ describe "Git", -> beforeEach -> workingDirPath = copyRepository() - repo = new Git(workingDirPath) + repo = new GitRepository(workingDirPath) filePath = path.join(workingDirPath, 'a.txt') it "no longer reports a path as modified after checkout", -> @@ -124,7 +124,7 @@ describe "Git", -> beforeEach -> workingDirPath = copyRepository() - repo = new Git(workingDirPath) + repo = new GitRepository(workingDirPath) filePath = path.join(workingDirPath, 'a.txt') fs.writeFileSync(filePath, 'ch ch changes') @@ -153,7 +153,7 @@ describe "Git", -> describe ".destroy()", -> it "throws an exception when any method is called after it is called", -> - repo = new Git(require.resolve('./fixtures/git/master.git/HEAD')) + repo = new GitRepository(require.resolve('./fixtures/git/master.git/HEAD')) repo.destroy() expect(-> repo.getShortHead()).toThrow() @@ -162,7 +162,7 @@ describe "Git", -> beforeEach -> workingDirectory = copyRepository() - repo = new Git(workingDirectory) + repo = new GitRepository(workingDirectory) filePath = path.join(workingDirectory, 'file.txt') it "trigger a status-changed event when the new status differs from the last cached one", -> @@ -182,7 +182,7 @@ describe "Git", -> beforeEach -> workingDirectory = copyRepository() - repo = new Git(workingDirectory) + repo = new GitRepository(workingDirectory) directoryPath = path.join(workingDirectory, 'dir') filePath = path.join(directoryPath, 'b.txt') @@ -197,7 +197,7 @@ describe "Git", -> beforeEach -> workingDirectory = copyRepository() - repo = new Git(workingDirectory) + repo = new GitRepository(workingDirectory) modifiedPath = path.join(workingDirectory, 'file.txt') newPath = path.join(workingDirectory, 'untracked.txt') cleanPath = path.join(workingDirectory, 'other.txt') diff --git a/src/project.coffee b/src/project.coffee index 361d9c950..529acd830 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -13,7 +13,7 @@ TextBuffer = require 'text-buffer' Editor = require './editor' Task = require './task' -Git = require './git' +GitRepository = require './git-repository' # Extended: Represents a project that's opened in Atom. # @@ -70,7 +70,7 @@ class Project extends Model Section: Accessing the git repository ### - # Public: Returns the {Git} repository if available. + # Public: Returns the {GitRepository} if available. getRepo: -> @repo ### @@ -93,7 +93,7 @@ class Project extends Model if projectPath? directory = if fs.isDirectorySync(projectPath) then projectPath else path.dirname(projectPath) @rootDirectory = new Directory(directory) - if @repo = Git.open(directory, project: this) + if @repo = GitRepository.open(directory, project: this) @repo.refreshIndex() @repo.refreshStatus() else