checkout: Better handling of '.git' suffix

Change-Id: Icb5ed16f216955073bb44ab7db7127f1f688e8b3
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/207607
Reviewed-by: Ted Pudlik <tpudlik@google.com>
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
diff --git a/recipe_modules/checkout/api.py b/recipe_modules/checkout/api.py
index d555385..0c8adf6 100644
--- a/recipe_modules/checkout/api.py
+++ b/recipe_modules/checkout/api.py
@@ -347,9 +347,9 @@
         # Sometimes remote1 or remote2 is None. In that case we shouldn't
         # convert sso to https.
         if remote1:
-            remote1 = self._api.sso.sso_to_https(remote1)
+            remote1 = self._api.sso.sso_to_https(remote1).removesuffix('.git')
         if remote2:
-            remote2 = self._api.sso.sso_to_https(remote2)
+            remote2 = self._api.sso.sso_to_https(remote2).removesuffix('.git')
         if remote1 == remote2:
             return True
         return remote1 in self.equivalent_remotes.get(remote2, ())
@@ -1457,9 +1457,7 @@
 
     def _name(self, options: Options):
         """Turn "https://foo/bar/baz.git" into "baz"."""
-        name = options.remote.rstrip('/')
-        if name.endswith('.git'):
-            name = name[:-4]
+        name = options.remote.rstrip('/').removesuffix('.git')
         parts = name.split('/')
         if options.use_repo and parts[-1] == 'manifest':
             parts.pop(-1)