Add specs for Git.isIgnored

This commit is contained in:
Kevin Sawicki
2012-10-26 16:24:47 -07:00
committed by Corey Johnson
parent a9baf54707
commit f5db2b63d8
14 changed files with 23 additions and 1 deletions

View File

@@ -51,7 +51,7 @@ public:
return CefV8Value::CreateBool(false);
int *ignored;
if (git_ignore_path_is_ignored(ignored, repo, path) == GIT_OK)
if (git_ignore_path_is_ignored(ignored, repo, path) >= GIT_OK)
return CefV8Value::CreateBool(*ignored == 1);
else
return CefV8Value::CreateBool(false);

View File

@@ -28,3 +28,12 @@ describe "Git", ->
it "returns a branch name for a non-empty repository", ->
repo = new Git(require.resolve('fixtures/git/master.git'))
expect(repo.getShortHead()).toBe 'master'
describe "isIgnored()", ->
it "returns true for an ignored path", ->
repo = new Git(require.resolve('fixtures/git/ignore.git'))
expect(repo.isIgnored('a.txt')).toBeTruthy()
it "returns false for a non-ignored path", ->
repo = new Git(require.resolve('fixtures/git/ignore.git'))
expect(repo.isIgnored('b.txt')).toBeFalsy()

View File

@@ -0,0 +1 @@
initial commit

1
spec/fixtures/git/ignore.git/HEAD vendored Normal file
View File

@@ -0,0 +1 @@
ref: refs/heads/master

6
spec/fixtures/git/ignore.git/config vendored Normal file
View File

@@ -0,0 +1,6 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true

View File

@@ -0,0 +1 @@
Unnamed repository; edit this file 'description' to name the repository.

BIN
spec/fixtures/git/ignore.git/index vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1 @@
a.txt

View File

@@ -0,0 +1 @@
0000000000000000000000000000000000000000 ef046e9eecaa5255ea5e9817132d4001724d6ae1 Kevin Sawicki <kevinsawicki@gmail.com> 1351201397 -0700 commit (initial): initial commit

View File

@@ -0,0 +1 @@
0000000000000000000000000000000000000000 ef046e9eecaa5255ea5e9817132d4001724d6ae1 Kevin Sawicki <kevinsawicki@gmail.com> 1351201397 -0700 commit (initial): initial commit

View File

@@ -0,0 +1 @@
ef046e9eecaa5255ea5e9817132d4001724d6ae1