[ARVADOS] updated: 1000275df3e0b4207ae60d51d25b96f74bd06c23

git at public.curoverse.com git at public.curoverse.com
Fri Jul 31 01:02:56 EDT 2015


Summary of changes:
 services/api/app/models/commit.rb | 32 ++++++++++++++++++++++++++------
 1 file changed, 26 insertions(+), 6 deletions(-)

       via  1000275df3e0b4207ae60d51d25b96f74bd06c23 (commit)
       via  465cb9225cce74600349239a295b1360ce2b0fa6 (commit)
       via  800e8ba4da76590c8cbe9801bef49a7ffb30bfbc (commit)
      from  70ce2cc8559b74907458797f7fbd8abb6e2c5a23 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 1000275df3e0b4207ae60d51d25b96f74bd06c23
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Jul 31 01:02:23 2015 -0400

    Whitespace
    
    No issue #

diff --git a/services/api/app/models/commit.rb b/services/api/app/models/commit.rb
index e4b789e..f74e2fe 100644
--- a/services/api/app/models/commit.rb
+++ b/services/api/app/models/commit.rb
@@ -72,7 +72,7 @@ class Commit < ActiveRecord::Base
     # If string is invalid, nothing else to do
     if !git_check_ref_format(max_hash)
       logger.warn "ref returned by `GIT_DIR=#{gitdir} #{git_max_hash_cmd}` was invalid for max_hash: #{max_hash}"
-      return[]
+      return []
     end
 
     resolved_exclude = nil

commit 465cb9225cce74600349239a295b1360ce2b0fa6
Merge: 70ce2cc 800e8ba
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Jul 31 01:02:11 2015 -0400

    Merge branch 'git-commit-debug' of https://github.com/wtsi-hgi/arvados
    
    No issue #


commit 800e8ba4da76590c8cbe9801bef49a7ffb30bfbc
Author: Joshua C. Randall <jcrandall at alum.mit.edu>
Date:   Fri Jul 31 02:00:28 2015 +0100

    Adds useful log warnings re: repo failures
    
    Instruments the find_commit_range function such that it logs an
    explanatory warning in any case when it fails to find any refs.
    
    When no refs are found, find_commit_range returns an empty list
    which typically causes its caller to throw an exception. Without
    these added warnings, that exception is not at all helpful in
    tracking down the underlying issue.

diff --git a/services/api/app/models/commit.rb b/services/api/app/models/commit.rb
index a6b0857..e4b789e 100644
--- a/services/api/app/models/commit.rb
+++ b/services/api/app/models/commit.rb
@@ -58,12 +58,22 @@ class Commit < ActiveRecord::Base
 
     # Get the commit hash for the upper bound
     max_hash = nil
-    IO.foreach("|git rev-list --max-count=1 #{maximum.shellescape} --") do |line|
+    git_max_hash_cmd = "git rev-list --max-count=1 #{maximum.shellescape} --"
+    IO.foreach("|#{git_max_hash_cmd}") do |line|
       max_hash = line.strip
     end
 
-    # If not found or string is invalid, nothing else to do
-    return [] if !max_hash or !git_check_ref_format(max_hash)
+    # If not found, nothing else to do
+    if !max_hash
+      logger.warn "no refs found looking for max_hash: `GIT_DIR=#{gitdir} #{git_max_hash_cmd}` returned no output"
+      return []
+    end
+
+    # If string is invalid, nothing else to do
+    if !git_check_ref_format(max_hash)
+      logger.warn "ref returned by `GIT_DIR=#{gitdir} #{git_max_hash_cmd}` was invalid for max_hash: #{max_hash}"
+      return[]
+    end
 
     resolved_exclude = nil
     if exclude
@@ -83,12 +93,22 @@ class Commit < ActiveRecord::Base
     if minimum
       # Get the commit hash for the lower bound
       min_hash = nil
-      IO.foreach("|git rev-list --max-count=1 #{minimum.shellescape} --") do |line|
+      git_min_hash_cmd = "git rev-list --max-count=1 #{minimum.shellescape} --"
+      IO.foreach("|#{git_min_hash_cmd}") do |line|
         min_hash = line.strip
       end
 
-      # If not found or string is invalid, nothing else to do
-      return [] if !min_hash or !git_check_ref_format(min_hash)
+      # If not found, nothing else to do
+      if !min_hash
+        logger.warn "no refs found looking for min_hash: `GIT_DIR=#{gitdir} #{git_min_hash_cmd}` returned no output"
+        return []
+      end
+
+      # If string is invalid, nothing else to do
+      if !git_check_ref_format(min_hash)
+        logger.warn "ref returned by `GIT_DIR=#{gitdir} #{git_min_hash_cmd}` was invalid for min_hash: #{min_hash}"
+        return []
+      end
 
       # Now find all commits between them
       IO.foreach("|git rev-list #{min_hash.shellescape}..#{max_hash.shellescape} --") do |line|

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list