Skip to content

Commit

Permalink
Merge pull request #40 from hamishcampbell/main
Browse files Browse the repository at this point in the history
Fix support for ssh clones of kart repos.
  • Loading branch information
volaya committed Nov 26, 2021
2 parents 75b3237 + 15bbb37 commit a808d2c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 8 additions & 3 deletions kart/gui/dockwidget.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import re
import tempfile

from qgis.PyQt import uic
Expand Down Expand Up @@ -246,9 +247,13 @@ def cloneRepo(self):
dialog.show()
ret = dialog.exec_()
if ret == dialog.Accepted:
repo = Repository.clone(
dialog.src, dialog.dst, dialog.location, dialog.extent
)

src = dialog.src
# Prefix file protocol if the protcol is otherwise unknown.
if not re.match(r"^(kart@|http(s)?://|file://).*", src):
src = f"file://{src}"

repo = Repository.clone(src, dialog.dst, dialog.location, dialog.extent)
item = RepoItem(repo)
self.addChild(item)
addRepo(repo)
Expand Down
2 changes: 0 additions & 2 deletions kart/kartapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,6 @@ def executeKart(self, commands, jsonoutput=False):

@staticmethod
def clone(src, dst, location=None, extent=None):
if "://" not in src:
src = f"file://{src}"
commands = ["-vv", "clone", src, dst, "--progress"]
if location is not None:
commands.extend(["--workingcopy", location])
Expand Down

0 comments on commit a808d2c

Please sign in to comment.