OSDN Git Service

Fix for git commit when nothing to commit.
authorDavid Barri <japgolly@gmail.com>
Thu, 8 Nov 2012 21:32:00 +0000 (08:32 +1100)
committerDavid Barri <japgolly@gmail.com>
Thu, 8 Nov 2012 21:32:00 +0000 (08:32 +1100)
Turns out git commit returns with 128 when user.name config not present.

lib/gitlab/backend/gitolite_config.rb

index a54608e..cb93186 100644 (file)
@@ -192,7 +192,9 @@ module Gitlab
     def push tmp_dir
       Dir.chdir(File.join(tmp_dir, "gitolite"))
       raise "Git add failed." unless system('git add -A')
-      raise "Git commit failed." unless system('git commit -am "GitLab"')
+      system('git commit -m "GitLab"') # git commit returns 0 on success, and 1 if there is nothing to commit
+      raise "Git commit failed." unless [0,1].include? $?.exitstatus
+
       if system('git push')
         Dir.chdir(Rails.root)
       else