require_relative 'git_crecord/git'
require_relative 'git_crecord/hunks'
require_relative 'git_crecord/ui'

module GitCrecord
  def self.main
    Dir.chdir(Git.toplevel_dir) do
      files = Hunks.parse(Git.diff)
      return false if files.empty?
      result = UI.run(files)
      return result.call == true if result.respond_to?(:call)
      0
    end
  end
end

require_relative 'git_crecord/git'
require_relative 'git_crecord/hunks'
require_relative 'git_crecord/ui'

module GitCrecord
  def self.main
    Dir.chdir(Git.toplevel_dir) do
      result = UI.run(Hunks.parse(Git.diff))
      return result.call == true if result.respond_to?(:call)
      0
    end
  end
end

--- 
+++ 
@@ -5,7 +5,9 @@
 module GitCrecord
   def self.main
     Dir.chdir(Git.toplevel_dir) do
-      result = UI.run(Hunks.parse(Git.diff))
+      files = Hunks.parse(Git.diff)
+      return false if files.empty?
+      result = UI.run(files)
       return result.call == true if result.respond_to?(:call)
       0
     end
Return 1 if nothing is changed
