
function mysplit(inputstr, sep)
	if sep == nil then
	  sep = "%s"
	end
	local t = {}
	for str in inputstr:gmatch("([^"..sep.."]+)") do
	  table.insert(t, str)
	end
	return t
end

core.register_action("set_repo_name", { "http-req" }, function(txn)
    local requestPath = txn.sf:path()
    local pp = mysplit(requestPath, "/")
    local queryString = txn.sf:query()
    local has_srv = string.find(queryString, "service=git-")
    local git = has_srv ~= nil
    local e = has_srv ~= nil and #pp-2 or #pp-1
    if pp[#pp] == "git-upload-pack" or pp[#pp] == "git-recieve-pack" then
        git = true
    end
    local s = 1
    if pp[1] == 'a' or pp[1] == 'p' then
        s = 2
    end
    local repo = ""
    if git then
        for k = s, e, 1 do
            repo = repo.."/"..pp[k]
        end
    else
        if pp[s] == "changes" or pp[s] == "projects" then
            repo = "/"
            if pp[s+1] ~= nil then
                repo = "/"..pp[s+1]
	    end
            local sep = string.find(repo, "~")
            if sep ~= nil then
                repo = string.sub(repo, 1, sep - 1)
            end
            repo = repo:gsub("%%2F", "/")
            repo = repo:gsub("%%2f", "/")
        end 
    end
    if repo == "" then
        repo = requestPath
    end
    txn.http:req_set_header("Gerrit-Project", repo)
   end)
   
