summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2015-11-05 16:02:02 +0000
committerDaniel Silverstone <dsilvers@digital-scurf.org>2015-11-05 16:02:02 +0000
commit7767eeb8e40468a8becab84961331466983cb30a (patch)
tree818974f7775abc5c55e24e41d825f365084b4adb
parentdc0bb76da986103ccf14595852cc301de6eaae4b (diff)
downloadgitano-7767eeb8e40468a8becab84961331466983cb30a.tar.bz2
Ensure uses of repo:save_admin() propagate author and committer
-rw-r--r--lib/gitano/command.lua4
-rw-r--r--lib/gitano/repository.lua20
2 files changed, 14 insertions, 10 deletions
diff --git a/lib/gitano/command.lua b/lib/gitano/command.lua
index 5cef86c..de3e4f2 100644
--- a/lib/gitano/command.lua
+++ b/lib/gitano/command.lua
@@ -593,7 +593,7 @@ local function builtin_config_run(conf, repo, cmdline, env)
end
repo.project_config.settings[key] = value
local ok, msg = repo:save_admin("Changed project setting: " .. key,
- env.GITANO_USER)
+ env.GITANO_USER, env.GITANO_ORIG_USER)
if not ok then
log.error(msg)
return "exit", 2
@@ -604,7 +604,7 @@ local function builtin_config_run(conf, repo, cmdline, env)
repo.project_config.settings[cmdline[4]] = nil
end
local ok, msg = repo:save_admin("Deleted project setting: " .. key,
- env.GITANO_USER)
+ env.GITANO_USER, env.GITANO_ORIG_USER)
if not ok then
log.error(msg)
return "exit", 2
diff --git a/lib/gitano/repository.lua b/lib/gitano/repository.lua
index 3cd1d30..3ee85e1 100644
--- a/lib/gitano/repository.lua
+++ b/lib/gitano/repository.lua
@@ -431,10 +431,11 @@ function repo_method:realise()
return self:run_checks()
end
-function repo_method:set_owner(newowner)
+function repo_method:set_owner(newowner, author, committer)
local oldowner = self:conf_get "project.owner"
self:conf_set("project.owner", newowner)
- local ok, msg = self:save_admin("Setting owner to " .. newowner)
+ local ok, msg = self:save_admin("Setting owner to " .. newowner,
+ author, committer)
if not ok then
self:conf_set("project.owner", oldowner)
return nil, msg
@@ -443,10 +444,11 @@ function repo_method:set_owner(newowner)
return true
end
-function repo_method:set_description(newdesc)
+function repo_method:set_description(newdesc, author, committer)
local olddesc = self:conf_get "project.description"
self:conf_set("project.description", newdesc)
- local ok, msg = self:save_admin("Changing description\n\n" .. newdesc)
+ local ok, msg = self:save_admin("Changing description\n\n" .. newdesc,
+ author, committer)
if not ok then
self:conf_set("project.description", olddesc)
return nil, msg
@@ -455,10 +457,11 @@ function repo_method:set_description(newdesc)
return true
end
-function repo_method:set_readme(newreadme)
+function repo_method:set_readme(newreadme, author, committer)
local oldreadme = self.readme_mdwn
self.readme_mdwn = newreadme
- local ok, msg = self:save_admin("Changing readme")
+ local ok, msg = self:save_admin("Changing readme",
+ author, committer)
if not ok then
self.readme_mdwn = oldreadme
return nil, msg
@@ -467,13 +470,14 @@ function repo_method:set_readme(newreadme)
return true
end
-function repo_method:set_head(newhead)
+function repo_method:set_head(newhead, author, committer)
if not newhead:match("^refs/") then
newhead = "refs/heads/" .. newhead
end
local oldhead = self:conf_get "project.head"
self:conf_set("project.head", newhead)
- local ok, msg = self:save_admin()
+ local ok, msg = self:save_admin("Changing project head",
+ author, committer)
if not ok then
self:conf_set("project.head", oldhead)
return nil, msg