Merge branch 'master' into 5735-edit-description-box-size
[arvados.git] / apps / workbench / app / models / repository.rb
index 28f8f0cc91124ceafd3dfce682b140c1a740659f..1caab89cc70fe643dc37965fcde5561ce0096f70 100644 (file)
@@ -48,13 +48,10 @@ class Repository < ArvadosBase
     subtree
   end
 
-  # git 2.1.4 does not use credential helpers reliably, see #5416
-  def self.disable_repository_browsing?
-    return false if Rails.configuration.use_git2_despite_bug_risk
-    if @buggy_git_version.nil?
-      @buggy_git_version = /git version 2/ =~ `git version`
-    end
-    @buggy_git_version
+  # http_fetch_url returns the first http:// or https:// url (if any)
+  # in the api response's clone_urls attribute.
+  def http_fetch_url
+    clone_urls.andand.select { |u| /^http/ =~ u }.first
   end
 
   protected
@@ -68,12 +65,6 @@ class Repository < ArvadosBase
     @fresh = true
   end
 
-  # http_fetch_url returns the first http:// or https:// url (if any)
-  # in the api response's clone_urls attribute.
-  def http_fetch_url
-    clone_urls.andand.select { |u| /^http/ =~ u }.first
-  end
-
   # run_git sets up the ARVADOS_API_TOKEN environment variable,
   # creates a local git directory for this repository if necessary,
   # executes "git --git-dir localgitdir {args to run_git}", and
@@ -96,7 +87,7 @@ class Repository < ArvadosBase
       "credential.#{http_fetch_url}.username", 'none'],
      ['git', '--git-dir', @workdir, 'config', '--local',
       "credential.#{http_fetch_url}.helper",
-      '!token(){ echo password="$ARVADOS_API_TOKEN"; }; token'],
+      '!cred(){ cat >/dev/null; if [ "$1" = get ]; then echo password=$ARVADOS_API_TOKEN; fi; };cred'],
      ['git', '--git-dir', @workdir, 'config', '--local',
            'http.sslVerify',
            Rails.configuration.arvados_insecure_https ? 'false' : 'true'],