gclient: Fix nested checkout bug when validating .gclient

BUG=355492

Review URL: https://codereview.chromium.org/209963002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@258989 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gclient_scm.py b/gclient_scm.py
index 76b4d8d..242b2c4 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -142,16 +142,12 @@
 
   def GetActualRemoteURL(self):
     """Attempt to determine the remote URL for this SCMWrapper."""
-    try:
+    if os.path.exists(os.path.join(self.checkout_path, '.git')):
       return shlex.split(scm.GIT.Capture(
           ['config', '--local', '--get-regexp', r'remote.*.url'],
           self.checkout_path))[1]
-    except Exception:
-      pass
-    try:
+    if os.path.exists(os.path.join(self.checkout_path, '.svn')):
       return scm.SVN.CaptureLocalInfo([], self.checkout_path)['URL']
-    except Exception:
-      pass
     return None
 
   def DoesRemoteURLMatch(self):