summaryrefslogtreecommitdiff
path: root/lib/gitano/admincommand.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitano/admincommand.lua')
-rw-r--r--lib/gitano/admincommand.lua16
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/gitano/admincommand.lua b/lib/gitano/admincommand.lua
index f565e96..d0d13ce 100644
--- a/lib/gitano/admincommand.lua
+++ b/lib/gitano/admincommand.lua
@@ -47,18 +47,12 @@ local function builtin_as_validate(config, _, cmdline)
cmdline.cmd = cmd
-- If the returned command needs a repo, find it (and save it for later)
local repo
- if cmd.takes_repo and #cmdline > 3 then
+ if cmd.takes_repo then
-- Acquire the repository object for the target repo
- local msg
- repo, msg = repository.find(config, cmdline[4])
- if not repo then
- log.critical("Unable to locate repository.")
- log.critical(" * " .. (tostring(msg)))
- log.fatal("Cannot continue")
- end
-
- if repo.is_nascent then
- log.info("Repository " .. repo.name .. " is nascent")
+ repo, cmdline.copy = cmd.detect_repo(config, cmdline.copy)
+ if not repo and not cmdline.copy then
+ log.error("Unable to continue")
+ return false
end
cmdline.repo = repo
end