fix: ref_exists also checks git-svn remote ref variant for imported tags/branches
This commit is contained in:
+11
-1
@@ -103,8 +103,18 @@ class MappingDB:
|
||||
).fetchall()
|
||||
|
||||
def ref_exists(self, git_ref: str) -> bool:
|
||||
# Also check the git-svn remote variant if this is a canonical ref
|
||||
variants = [git_ref]
|
||||
if git_ref.startswith("refs/tags/"):
|
||||
variants.append("refs/remotes/origin/tags/" + git_ref[10:])
|
||||
elif git_ref == "refs/heads/master":
|
||||
variants.append("refs/remotes/origin/trunk")
|
||||
elif git_ref.startswith("refs/heads/"):
|
||||
variants.append("refs/remotes/origin/" + git_ref[11:])
|
||||
row = self.conn.execute(
|
||||
"SELECT 1 FROM svn_to_git WHERE git_ref=?", (git_ref,)
|
||||
"SELECT 1 FROM svn_to_git WHERE git_ref IN ({})".format(
|
||||
",".join("?" * len(variants))
|
||||
), variants
|
||||
).fetchone()
|
||||
return row is not None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user