summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/gitano/repository.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/gitano/repository.lua b/lib/gitano/repository.lua
index 36f9579..9667073 100644
--- a/lib/gitano/repository.lua
+++ b/lib/gitano/repository.lua
@@ -522,6 +522,16 @@ function repo_method:copy_to(target)
return false, "Cannot prepare path leading to repository."
end
+ -- attempt to create the target directory, so we can detect
+ -- a copy is already in progress and return without removing
+ -- the target directory
+ ok, err = luxio.mkdir(temp_path, sio.tomode'0755')
+ if ok ~= 0 then
+ log.error("Failed to copy repository", self:fs_path(),
+ "to", newpath .. ":", "Copy already in progress")
+ return false, "Copy already in progress"
+ end
+
local from = self:fs_path()
local function filter(parent, name, info)
return parent == from and name == "objects"