Skip to content

Commit

Permalink
Add explicit message when Git is not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonblalock committed Jul 9, 2017
1 parent b0bb4ef commit 4dfe76a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/react_on_rails/git_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ def self.uncommitted_changes?(message_handler)
return false if ENV["COVERAGE"] == "true"
status = `git status --porcelain`
return false if $CHILD_STATUS.success? && status.empty?
error = "You have uncommitted code. Please commit or stash your changes before continuing"
if !$CHILD_STATUS.success?
error = "You do not have Git installed. Please install Git, and commit your changes before continuing"
else
error = "You have uncommitted code. Please commit or stash your changes before continuing"
end
message_handler.add_error(error)
true
end
Expand Down
2 changes: 1 addition & 1 deletion spec/react_on_rails/git_utils_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module ReactOnRails
allow(described_class).to receive(:`).with("git status --porcelain").and_return(subject)
allow_any_instance_of(Process::Status).to receive(:success?).and_return(false)
expect(message_handler).to receive(:add_error)
.with("You have uncommitted code. Please commit or stash your changes before continuing")
.with("You do not have Git installed. Please install Git, and commit your changes before continuing")
end

it "returns true" do
Expand Down

0 comments on commit 4dfe76a

Please sign in to comment.