diff --git a/spec/fixtures/git/repo-with-submodules/You-Dont-Need-jQuery/README.md b/spec/fixtures/git/repo-with-submodules/You-Dont-Need-jQuery/README.md index 6476f5034..ae897dce6 100644 --- a/spec/fixtures/git/repo-with-submodules/You-Dont-Need-jQuery/README.md +++ b/spec/fixtures/git/repo-with-submodules/You-Dont-Need-jQuery/README.md @@ -2,6 +2,7 @@ Frontend environments evolve rapidly nowadays, modern browsers have already implemented a great deal of DOM/BOM APIs which are good enough. We don't have to learn jQuery from scratch for DOM manipulation or events. In the meantime, thanks to the prevailment of frontend libraries such as React, Angular and Vue, manipulating DOM directly becomes anti-pattern, jQuery has never been less important. This project summarizes most of the jQuery method alternatives in native implementation, with IE 10+ support. + ## Table of Contents 1. [Query Selector](#query-selector) diff --git a/spec/fixtures/git/repo-with-submodules/git.git/modules/You-Dont-Need-jQuery/COMMIT_EDITMSG b/spec/fixtures/git/repo-with-submodules/git.git/modules/You-Dont-Need-jQuery/COMMIT_EDITMSG new file mode 100644 index 000000000..2ce36ac82 --- /dev/null +++ b/spec/fixtures/git/repo-with-submodules/git.git/modules/You-Dont-Need-jQuery/COMMIT_EDITMSG @@ -0,0 +1,9 @@ +whitespace is nicespace +# Please enter the commit message for your changes. Lines starting +# with '#' will be ignored, and an empty message aborts the commit. +# On branch master +# Your branch is up-to-date with 'origin/master'. +# +# Changes to be committed: +# modified: README.md +# diff --git a/spec/fixtures/git/repo-with-submodules/git.git/modules/You-Dont-Need-jQuery/index b/spec/fixtures/git/repo-with-submodules/git.git/modules/You-Dont-Need-jQuery/index index 202c1f9ce..af63d76e5 100644 Binary files a/spec/fixtures/git/repo-with-submodules/git.git/modules/You-Dont-Need-jQuery/index and b/spec/fixtures/git/repo-with-submodules/git.git/modules/You-Dont-Need-jQuery/index differ diff --git a/spec/fixtures/git/repo-with-submodules/git.git/modules/You-Dont-Need-jQuery/logs/HEAD b/spec/fixtures/git/repo-with-submodules/git.git/modules/You-Dont-Need-jQuery/logs/HEAD index a76a6d29f..8b2542f26 100644 --- a/spec/fixtures/git/repo-with-submodules/git.git/modules/You-Dont-Need-jQuery/logs/HEAD +++ b/spec/fixtures/git/repo-with-submodules/git.git/modules/You-Dont-Need-jQuery/logs/HEAD @@ -1 +1,2 @@ 0000000000000000000000000000000000000000 2e9bbc77d60f20eb462ead5b2ac7405b62b9b90a joshaber 1452186236 -0500 clone: from https://github.com/oneuijs/You-Dont-Need-jQuery +2e9bbc77d60f20eb462ead5b2ac7405b62b9b90a a78b35a896b890f0a2a4f1f924c5739776415250 joshaber 1452202510 -0500 commit: whitespace is nicespace diff --git a/spec/fixtures/git/repo-with-submodules/git.git/modules/You-Dont-Need-jQuery/logs/refs/heads/master b/spec/fixtures/git/repo-with-submodules/git.git/modules/You-Dont-Need-jQuery/logs/refs/heads/master index a76a6d29f..8b2542f26 100644 --- a/spec/fixtures/git/repo-with-submodules/git.git/modules/You-Dont-Need-jQuery/logs/refs/heads/master +++ b/spec/fixtures/git/repo-with-submodules/git.git/modules/You-Dont-Need-jQuery/logs/refs/heads/master @@ -1 +1,2 @@ 0000000000000000000000000000000000000000 2e9bbc77d60f20eb462ead5b2ac7405b62b9b90a joshaber 1452186236 -0500 clone: from https://github.com/oneuijs/You-Dont-Need-jQuery +2e9bbc77d60f20eb462ead5b2ac7405b62b9b90a a78b35a896b890f0a2a4f1f924c5739776415250 joshaber 1452202510 -0500 commit: whitespace is nicespace diff --git a/spec/fixtures/git/repo-with-submodules/git.git/modules/You-Dont-Need-jQuery/objects/a7/8b35a896b890f0a2a4f1f924c5739776415250 b/spec/fixtures/git/repo-with-submodules/git.git/modules/You-Dont-Need-jQuery/objects/a7/8b35a896b890f0a2a4f1f924c5739776415250 new file mode 100644 index 000000000..756c94ceb --- /dev/null +++ b/spec/fixtures/git/repo-with-submodules/git.git/modules/You-Dont-Need-jQuery/objects/a7/8b35a896b890f0a2a4f1f924c5739776415250 @@ -0,0 +1,2 @@ +xQ +0D)remDfk#)m73aF 1452186187 -0500 clone: from https://github.com/loverajoel/jstips +9f0218b7652b622afea799a4723490c43e1af1fe 9f0218b7652b622afea799a4723490c43e1af1fe joshaber 1452201852 -0500 checkout: moving from master to test +9f0218b7652b622afea799a4723490c43e1af1fe 0525ef667328cb1f86b1ddf523db4a064e1590fa joshaber 1452201881 -0500 commit: whitespace is nicespace diff --git a/spec/fixtures/git/repo-with-submodules/git.git/modules/jstips/logs/refs/heads/test b/spec/fixtures/git/repo-with-submodules/git.git/modules/jstips/logs/refs/heads/test new file mode 100644 index 000000000..97fc9fe1a --- /dev/null +++ b/spec/fixtures/git/repo-with-submodules/git.git/modules/jstips/logs/refs/heads/test @@ -0,0 +1,2 @@ +0000000000000000000000000000000000000000 9f0218b7652b622afea799a4723490c43e1af1fe joshaber 1452201852 -0500 branch: Created from HEAD +9f0218b7652b622afea799a4723490c43e1af1fe 0525ef667328cb1f86b1ddf523db4a064e1590fa joshaber 1452201881 -0500 commit: whitespace is nicespace diff --git a/spec/fixtures/git/repo-with-submodules/git.git/modules/jstips/objects/05/25ef667328cb1f86b1ddf523db4a064e1590fa b/spec/fixtures/git/repo-with-submodules/git.git/modules/jstips/objects/05/25ef667328cb1f86b1ddf523db4a064e1590fa new file mode 100644 index 000000000..453565277 --- /dev/null +++ b/spec/fixtures/git/repo-with-submodules/git.git/modules/jstips/objects/05/25ef667328cb1f86b1ddf523db4a064e1590fa @@ -0,0 +1,2 @@ +x] }{ ,?bliZחݷ7IuK6fQ`u8h2RVlI dY2 2͊,ݦEzc:@( +}K{gQ|x_)1~F|QBI \ No newline at end of file diff --git a/spec/fixtures/git/repo-with-submodules/git.git/modules/jstips/objects/1a/dd860234dad4a8bf59340363e9c88bb0457cb7 b/spec/fixtures/git/repo-with-submodules/git.git/modules/jstips/objects/1a/dd860234dad4a8bf59340363e9c88bb0457cb7 new file mode 100644 index 000000000..e523c5ae2 Binary files /dev/null and b/spec/fixtures/git/repo-with-submodules/git.git/modules/jstips/objects/1a/dd860234dad4a8bf59340363e9c88bb0457cb7 differ diff --git a/spec/fixtures/git/repo-with-submodules/git.git/modules/jstips/objects/5b/35953562dbb4f2debe88fcc9ac1805064e1e5a b/spec/fixtures/git/repo-with-submodules/git.git/modules/jstips/objects/5b/35953562dbb4f2debe88fcc9ac1805064e1e5a new file mode 100644 index 000000000..3065a654f Binary files /dev/null and b/spec/fixtures/git/repo-with-submodules/git.git/modules/jstips/objects/5b/35953562dbb4f2debe88fcc9ac1805064e1e5a differ diff --git a/spec/fixtures/git/repo-with-submodules/git.git/modules/jstips/refs/heads/test b/spec/fixtures/git/repo-with-submodules/git.git/modules/jstips/refs/heads/test new file mode 100644 index 000000000..71704a9f7 --- /dev/null +++ b/spec/fixtures/git/repo-with-submodules/git.git/modules/jstips/refs/heads/test @@ -0,0 +1 @@ +0525ef667328cb1f86b1ddf523db4a064e1590fa diff --git a/spec/fixtures/git/repo-with-submodules/jstips/README.md b/spec/fixtures/git/repo-with-submodules/jstips/README.md index dfdb3a5f9..1add86023 100644 --- a/spec/fixtures/git/repo-with-submodules/jstips/README.md +++ b/spec/fixtures/git/repo-with-submodules/jstips/README.md @@ -1,5 +1,6 @@ ![header](https://raw.githubusercontent.com/loverajoel/jstips/master/resources/jstips-header-blog.gif) + # Introducing Javascript Tips > New year, new project. **A JS tip per day!** @@ -28,7 +29,7 @@ You just have to concat everything into an array first. `Array.concat` will acce ```javascript function printUpperCase(words) { - var elements = [].concat(words); + var elements = [].concat(words); for (var i = 0; i < elements.length; i++) { console.log(elements[i].toUpperCase()); } @@ -38,7 +39,7 @@ function printUpperCase(words) { `printUpperCase` is now ready to accept a single node or an array of nodes as it's parameter. ```javascript -printUpperCase("cactus"); +printUpperCase("cactus"); // => CACTUS printUpperCase(["cactus", "bear", "potato"]); // => CACTUS diff --git a/spec/git-repository-async-spec.js b/spec/git-repository-async-spec.js index e6084e6ad..039ed66e6 100644 --- a/spec/git-repository-async-spec.js +++ b/spec/git-repository-async-spec.js @@ -552,6 +552,20 @@ describe('GitRepositoryAsync', () => { const head = await repo.getShortHead() expect(head).toBe('master') }) + + describe('in a submodule', () => { + beforeEach(() => { + const workingDirectory = copySubmoduleRepository() + repo = GitRepositoryAsync.open(workingDirectory) + }) + + it('returns the human-readable branch name', async () => { + await repo.refreshStatus() + + const head = await repo.getShortHead('jstips') + expect(head).toBe('test') + }) + }) }) describe('.getAheadBehindCount(reference, path)', () => { @@ -575,10 +589,26 @@ describe('GitRepositoryAsync', () => { it('returns 0, 0 for a branch with no upstream', async () => { await repo.refreshStatus() - const {ahead, behind} = repo.getCachedUpstreamAheadBehindCount() + + const {ahead, behind} = await repo.getCachedUpstreamAheadBehindCount() expect(ahead).toBe(0) expect(behind).toBe(0) }) + + describe('in a submodule', () => { + beforeEach(() => { + const workingDirectory = copySubmoduleRepository() + repo = GitRepositoryAsync.open(workingDirectory) + }) + + it('returns 0, 0 for a branch with no upstream', async () => { + await repo.refreshStatus() + + const {ahead, behind} = await repo.getCachedUpstreamAheadBehindCount('You-Dont-Need-jQuery') + expect(ahead).toBe(1) + expect(behind).toBe(0) + }) + }) }) describe('.getDiffStats(path)', () => {