Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from diff-index to diff #9

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/diff-check
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

if ! git diff-index --quiet HEAD; then
if ! git diff --quiet HEAD; then
printf 'These files changed when running the command:\n\n'

git diff --name-only | while read -r n ; do
Expand Down
20 changes: 20 additions & 0 deletions spec/black_box/diff-check_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,31 @@
end
end

context "with a non-content file change" do
it "emits no output" do
session = create_session

session.run("touch README")

expect(session.run("diff-check")).to have_no_stdout
expect(session.run("diff-check")).to have_no_stderr
end

it "exits with a status of 0" do
session = create_session

session.run("touch README")

expect(session.run("diff-check")).to be_a_success
end
end

def create_session
session = JetBlack::Session.new

session.run("git init")
session.run("echo 'Hello world' >> README")
session.run("touch -d '2 hours ago' README")
session.run("git add .; git commit -m 'initial commit'")

session
Expand Down