git_retry: Disable retries under Git wrapper.

If the Infra Git wrapper is managing a Git execution, "git_retry" will
impose a second set of retries. Recognize this situation and disable
"git_retry" so that the Git wrapper is the sole managing process.

BUG=chromium:703868
TEST=local
  - Ran with and without environment variable, seems to work.

Change-Id: I4f749c9693a761abe2a062ed5f1dc09f51c69e30
Reviewed-on: https://chromium-review.googlesource.com/469229
Commit-Queue: Daniel Jacques <dnj@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
diff --git a/git_retry.py b/git_retry.py
index d6dee65..c153e12 100755
--- a/git_retry.py
+++ b/git_retry.py
@@ -3,8 +3,16 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+
+"""Generic retry wrapper for Git operations. 
+
+This is largely DEPRECATED in favor of the Infra Git wrapper:
+https://chromium.googlesource.com/infra/infra/+/master/go/src/infra/tools/git
+"""
+
 import logging
 import optparse
+import os
 import subprocess
 import sys
 import threading
@@ -111,6 +119,11 @@
 
 
 def main(args):
+  # If we're using the Infra Git wrapper, do nothing here.
+  # https://chromium.googlesource.com/infra/infra/+/master/go/src/infra/tools/git
+  if 'INFRA_GIT_WRAPPER' in os.environ:
+    return subprocess.call([GIT_EXE] + args)
+
   parser = optparse.OptionParser()
   parser.disable_interspersed_args()
   parser.add_option('-v', '--verbose',