From df33508825a18a51d4fa3fd8fde555f85b3de608 Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Thu, 28 Jul 2022 09:47:36 +0200
Subject: [PATCH] test github with only fast sha

---
 app/services/git/providers/github.rb | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/app/services/git/providers/github.rb b/app/services/git/providers/github.rb
index 51da537ec..5bc891989 100644
--- a/app/services/git/providers/github.rb
+++ b/app/services/git/providers/github.rb
@@ -54,15 +54,15 @@ class Git::Providers::Github < Git::Providers::Abstract
     return if path.nil?
     # Try to find in stored tree to avoid multiple queries
     return hash_for_paths[path] if hash_for_paths.has_key? path
-    begin
-      # The fast way, with no query, does not work.
-      # Let's query the API 
-      content = client.content repository, path: path
-      sha = content[:sha]
-    rescue
-      sha = nil
-    end
-    sha
+    # This is still generating too many requests, so we try based only on the tree  
+    # begin
+    #   # The fast way, with no query, does not work.
+    #   # Let's query the API.
+    #   content = client.content repository, path: path
+    #   return content[:sha]
+    # rescue
+    # end
+    nil
   end
 
   protected
-- 
GitLab