diff --git a/package.json b/package.json index 957d262f0..2874eaeb0 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "marked": "^0.3.4", "normalize-package-data": "^2.0.0", "nslog": "^3", - "ohnogit": "0.0.9", + "ohnogit": "0.0.11", "oniguruma": "^5", "pathwatcher": "~6.2", "property-accessors": "^1.1.3", @@ -107,7 +107,7 @@ "settings-view": "0.235.1", "snippets": "1.0.2", "spell-check": "0.67.1", - "status-bar": "1.2.4", + "status-bar": "1.2.6", "styleguide": "0.45.2", "symbols-view": "0.112.0", "tabs": "0.93.1", diff --git a/resources/win/atom.cmd b/resources/win/atom.cmd index 8a4fed05c..73c4ddb01 100644 --- a/resources/win/atom.cmd +++ b/resources/win/atom.cmd @@ -27,6 +27,7 @@ IF "%EXPECT_OUTPUT%"=="YES" ( SET ELECTRON_ENABLE_LOGGING=YES IF "%WAIT%"=="YES" ( powershell -noexit "Start-Process -FilePath \"%~dp0\..\..\atom.exe\" -ArgumentList \"--pid=$pid $env:PSARGS\" ; wait-event" + exit 0 ) ELSE ( "%~dp0\..\..\atom.exe" %* ) diff --git a/spec/fixtures/git/repo-with-submodules/git.git/config b/spec/fixtures/git/repo-with-submodules/git.git/config index ab57cc5f1..323ba7d9b 100644 --- a/spec/fixtures/git/repo-with-submodules/git.git/config +++ b/spec/fixtures/git/repo-with-submodules/git.git/config @@ -5,6 +5,12 @@ logallrefupdates = true ignorecase = true precomposeunicode = true +[branch "master"] + remote = origin + merge = refs/heads/master +[remote "origin"] + url = git@github.com:atom/some-repo-i-guess.git + fetch = +refs/heads/*:refs/remotes/origin/* [submodule "jstips"] url = https://github.com/loverajoel/jstips [submodule "You-Dont-Need-jQuery"] diff --git a/spec/fixtures/git/repo-with-submodules/git.git/refs/remotes/origin/master b/spec/fixtures/git/repo-with-submodules/git.git/refs/remotes/origin/master new file mode 100644 index 000000000..3507a23dc --- /dev/null +++ b/spec/fixtures/git/repo-with-submodules/git.git/refs/remotes/origin/master @@ -0,0 +1 @@ +d2b0ad9cbc6f6c4372e8956e5cc5af771b2342e5 diff --git a/spec/git-repository-async-spec.js b/spec/git-repository-async-spec.js index d36b9fd58..1fbe537d5 100644 --- a/spec/git-repository-async-spec.js +++ b/spec/git-repository-async-spec.js @@ -877,4 +877,34 @@ describe('GitRepositoryAsync', () => { }) }) }) + + describe('.getOriginURL()', () => { + beforeEach(() => { + const workingDirectory = copyRepository('repo-with-submodules') + repo = GitRepositoryAsync.open(workingDirectory) + }) + + it('returns the origin URL', async () => { + const url = await repo.getOriginURL() + expect(url).toBe('git@github.com:atom/some-repo-i-guess.git') + }) + }) + + describe('.getUpstreamBranch()', () => { + it('returns null when there is no upstream branch', async () => { + const workingDirectory = copyRepository() + repo = GitRepositoryAsync.open(workingDirectory) + + const upstream = await repo.getUpstreamBranch() + expect(upstream).toBe(null) + }) + + it('returns the upstream branch', async () => { + const workingDirectory = copyRepository('repo-with-submodules') + repo = GitRepositoryAsync.open(workingDirectory) + + const upstream = await repo.getUpstreamBranch() + expect(upstream).toBe('refs/remotes/origin/master') + }) + }) }) diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index ccc68535f..109b791a1 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -136,9 +136,6 @@ class DisplayBuffer extends Model onDidChangeGrammar: (callback) -> @tokenizedBuffer.onDidChangeGrammar(callback) - onDidUseGrammar: (callback) -> - @tokenizedBuffer.onDidUseGrammar(callback) - onDidTokenize: (callback) -> @tokenizedBuffer.onDidTokenize(callback) diff --git a/src/git-repository-async.js b/src/git-repository-async.js index 37131dd24..b691994bc 100644 --- a/src/git-repository-async.js +++ b/src/git-repository-async.js @@ -234,7 +234,7 @@ export default class GitRepositoryAsync { // Returns a {Promise} which resolves to the {String} origin url of the // repository. getOriginURL (_path) { - return this.repo.getOriginalURL(_path) + return this.repo.getOriginURL(_path) } // Public: Returns the upstream branch for the current HEAD, or null if there @@ -246,7 +246,7 @@ export default class GitRepositoryAsync { // Returns a {Promise} which resolves to a {String} branch name such as // `refs/remotes/origin/master`. getUpstreamBranch (_path) { - return this.getUpstreamBranch(_path) + return this.repo.getUpstreamBranch(_path) } // Public: Gets all the local and remote references. diff --git a/src/text-editor.coffee b/src/text-editor.coffee index e30696479..922d9abf7 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -320,9 +320,6 @@ class TextEditor extends Model onDidChangeGrammar: (callback) -> @emitter.on 'did-change-grammar', callback - onDidUseGrammar: (callback) -> - @displayBuffer.onDidUseGrammar(callback) - # Extended: Calls your `callback` when the result of {::isModified} changes. # # * `callback` {Function} diff --git a/src/tokenized-buffer.coffee b/src/tokenized-buffer.coffee index 7e3c4fe49..065715806 100644 --- a/src/tokenized-buffer.coffee +++ b/src/tokenized-buffer.coffee @@ -128,14 +128,6 @@ class TokenizedBuffer extends Model @emitter.emit 'did-change-grammar', grammar - # Delay this to the next tick to ensure whoever created the buffer has the - # chance to listen for this event before we send it. - process.nextTick => - @emitter.emit 'did-use-grammar', grammar - - onDidUseGrammar: (callback) -> - @emitter.on 'did-use-grammar', callback - getGrammarSelectionContent: -> @buffer.getTextInRange([[0, 0], [10, 0]]) diff --git a/src/workspace.coffee b/src/workspace.coffee index 8f973d2fa..6f9be3886 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -550,13 +550,15 @@ class Workspace extends Model @project.bufferForPath(filePath, options).then (buffer) => editor = @buildTextEditor(_.extend({buffer, largeFileMode}, options)) disposable = atom.textEditors.add(editor) - grammarSubscription = editor.onDidUseGrammar(@handleGrammarUsed.bind(this)) + grammarSubscription = editor.observeGrammar(@handleGrammarUsed.bind(this)) editor.onDidDestroy -> grammarSubscription.dispose() disposable.dispose() editor handleGrammarUsed: (grammar) -> + return unless grammar? + @packageManager.triggerActivationHook("#{grammar.packageName}:grammar-used") # Public: Returns a {Boolean} that is `true` if `object` is a `TextEditor`.