Skip to content

Commit

Permalink
Explain when a given reference is not valid
Browse files Browse the repository at this point in the history
  • Loading branch information
pablobm committed Apr 29, 2021
1 parent 53c9068 commit 0af6627
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions bin/changelog
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/env ruby

def silent_run(cmd)
pid = spawn(cmd, out: "/dev/null", err: "/dev/null")
Process.wait(pid)
$?.success?
end

if ARGV.count != 1
script = $0
puts "Usage:"
Expand All @@ -12,6 +18,11 @@ end

gitref = ARGV.first

unless silent_run("git cat-file -t #{gitref}")
puts "The given git reference `#{gitref}` does not exist in this repository."
exit 1
end

files = `git diff --name-only #{gitref} | grep html.erb`

if files.empty?
Expand Down

0 comments on commit 0af6627

Please sign in to comment.