Skip to content
This repository was archived by the owner on Feb 19, 2020. It is now read-only.

Commit b9f803d

Browse files
committed
Work dir is skipped if no git dir is found
1 parent 51d7cbd commit b9f803d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/codacy/git.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ def self.commit_id
1414
end
1515

1616
def self.work_dir
17-
work_dir = ENV['WORK_DIR'] || git_dir
17+
work_dir = ENV['WORK_DIR'] ||
18+
ENV['TRAVIS_BUILD_DIR'] ||
19+
git_dir
1820
work_dir
1921
end
2022

@@ -23,7 +25,12 @@ def self.git_commit
2325
end
2426

2527
def self.git_dir
26-
return `git rev-parse --show-toplevel`.strip!
28+
dir = `git rev-parse --show-toplevel`
29+
if $?.to_i == 0
30+
return dir.strip!
31+
else
32+
return ''
33+
end
2734
end
2835

2936
def self.git(command)

0 commit comments

Comments
 (0)