This commit is contained in:
@@ -67,7 +67,7 @@ def ensure(name: str, checkout: pathlib.Path, others: list[pathlib.Path], git: G
|
||||
|
||||
def without_credentials(url: str) -> str:
|
||||
"""url without a `user:token@` after its scheme, so that a clone and a question for the team never carry one. The clone then uses git's own credentials."""
|
||||
return re.sub(r"^(https?://)[^/@]*@", r"\1", url)
|
||||
return re.sub(r"^(https?://)[^/]*@", r"\1", url)
|
||||
|
||||
|
||||
def clone_url(name: str, others: list[pathlib.Path], git: Git) -> str | Failure:
|
||||
|
||||
@@ -137,11 +137,11 @@ class LocateTest(unittest.TestCase):
|
||||
def test_clones_and_asks_without_the_credentials_an_origin_holds(self) -> None:
|
||||
self.configure()
|
||||
self.origins[str(self.billing)] = "https://bot:s3cret@gitea.larvit.se/acme/billing"
|
||||
self.origins[str(self.payments)] = "https://other:t0ken@gitea.larvit.se/acme/payments.git"
|
||||
self.origins[str(self.payments)] = "https://other:t0@ken@gitea.larvit.se/acme/payments.git"
|
||||
git = FakeGit(self.origins)
|
||||
self.assertIsInstance(self.locate(git), Located)
|
||||
self.assertEqual(git.cloned, [("https://gitea.larvit.se/acme/ledger", str(self.home / "code" / "ledger"))])
|
||||
self.origins[str(self.payments)] = "https://other:t0ken@gitea.larvit.se/acme/payments"
|
||||
self.origins[str(self.payments)] = "https://other:t0@ken@gitea.larvit.se/acme/payments"
|
||||
self.origins[str(self.billing)] = "https://bot:s3cret@gitea.larvit.se"
|
||||
self.assertNotIn("s3cret", self.unsure(FakeGit(self.origins), "stock"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user