mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +00:00
Handle repo cleanup race more elegantly (#3930)
* Don't attempt to get pwd for error message * Print error instead of raising exception This is more user-friendly too. * Switch back to raise, but rescue it too * Refactor
This commit is contained in:
@@ -117,9 +117,8 @@ def git_linguist(args)
|
||||
end
|
||||
|
||||
parser.parse!(args)
|
||||
|
||||
git_dir = `git rev-parse --git-dir`.strip
|
||||
raise "git-linguist must be run in a Git repository (#{Dir.pwd})" unless $?.success?
|
||||
raise "git-linguist must be run in a Git repository" unless $?.success?
|
||||
wrapper = GitLinguist.new(git_dir, commit, incremental)
|
||||
|
||||
case args.pop
|
||||
@@ -141,6 +140,10 @@ def git_linguist(args)
|
||||
$stderr.print(parser.help)
|
||||
exit 1
|
||||
end
|
||||
rescue Exception => e
|
||||
$stderr.puts e.message
|
||||
$stderr.puts e.backtrace
|
||||
exit 1
|
||||
end
|
||||
|
||||
git_linguist(ARGV)
|
||||
|
||||
Reference in New Issue
Block a user