summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2014-04-04 14:21:43 +0000
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2014-04-04 14:21:43 +0000
commita1eca9a94e34407073605614b56d13c3738cbfa9 (patch)
treedb540104c96baa21744d8607e81b176a3f95d424
parent77266b3ec2efec51f0a3246cbad70a4f15835958 (diff)
parentfd908026c2d12ac83c51fe9ed57c3316230ea105 (diff)
downloadgitano-baserock/danielsilverstone/upgrade-gitano-fix-rsync.tar.gz
Merge remote-tracking branch 'origin/master' into baserock/danielsilverstone/upgrade-gitano-fix-rsyncbaserock/danielsilverstone/upgrade-gitano-fix-rsync
Update to latest upstream, including some caching of data and a fix to allow rsync to file paths deeper inside repos.
-rw-r--r--Makefile10
-rw-r--r--lib/gitano/util.lua8
-rw-r--r--plugins/rsync.lua5
3 files changed, 20 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index cab0162..9651c0e 100644
--- a/Makefile
+++ b/Makefile
@@ -155,9 +155,17 @@ install-plugins:
install -m 644 plugins/$$PLUGIN $(DESTDIR)$(INST_ROOT)/lib/gitano/plugins; \
done
+YARN_ARGS :=
+ifneq ($(LUA_PATH),)
+YARN_ARGS += --env LUA_PATH="$(LUA_PATH)"
+endif
+ifneq ($(LUA_CPATH),)
+YARN_ARGS += --env LUA_CPATH="$(LUA_CPATH)"
+endif
+
test: local $(TEST_BINS)
@$(YARN) --env GTT="$$(pwd)/testing/gitano-test-tool" \
- --env LUA_PATH="$(LUA_PATH)" --env LUA_CPATH="$(LUA_CPATH)" \
+ $(YARN_ARGS) \
testing/library.yarn $(TESTS)
testing/%: testing/%.in $(GEN_BIN)
diff --git a/lib/gitano/util.lua b/lib/gitano/util.lua
index c2a53a7..291c68d 100644
--- a/lib/gitano/util.lua
+++ b/lib/gitano/util.lua
@@ -337,12 +337,18 @@ end
local tagname_pattern = "^[a-z0-9_%-/]*[a-z0-9_%-]*$"
+local cached_expansions = {}
+
local function prep_expansion(str)
-- Parse 'str' and return a table representing a sequence of
-- operations required to evaluate the expansion of the string.
-- in the simple case, it's merely the string in a table
-- if the entry in ret is a string, it's copied. If it's a table
-- then that table's [1] is a string which is a tag name to expand.
+ if cached_expansions[str] then
+ return cached_expansions[str]
+ end
+
local ret = {}
local acc = ""
local c
@@ -386,6 +392,8 @@ local function prep_expansion(str)
ret[#ret+1] = acc
end
+ cached_expansions[str] = ret
+
return ret
end
diff --git a/plugins/rsync.lua b/plugins/rsync.lua
index 310fe59..8f8c8da 100644
--- a/plugins/rsync.lua
+++ b/plugins/rsync.lua
@@ -39,9 +39,10 @@ local function rsync_detect_repo(config, cmdline)
-- Basically, while there's still something to the repopath
-- and we've not yet found a repo, strip an element and try again...
- while not repo and repopath ~= ""do
+ while (not repo or repo.is_nascent) and repopath ~= ""do
+ gitano.log.error("Trying " .. repopath)
repo, msg = gitano.repository.find(config, repopath)
- if not repo then
+ if not repo or repo.is_nascent then
repopath = repopath:match("^(.*)/[^/]*$") or ""
end
end