Skip to content

Commit

Permalink
Merge pull request #6 from mnicky/master
Browse files Browse the repository at this point in the history
optional arguments to suppress printing of fetch progress
  • Loading branch information
mkottman committed Jan 17, 2013
2 parents c990394 + 41764f5 commit 9159006
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lua/git/protocol.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ local function git_connect(host)
return gitsocket
end

local function git_fetch(host, path, repo, head)
local function git_fetch(host, path, repo, head, supress_progress)
local s = git_connect(host)
s:send('git-upload-pack '..path..'\0host='..host..'\0')

Expand Down Expand Up @@ -101,7 +101,7 @@ local function git_fetch(host, path, repo, head)
if cmd == 1 then
packfile:write(data)
elseif cmd == 2 then
io.write(data)
if not supress_progress then io.write(data) end
else
error(data)
end
Expand All @@ -125,11 +125,11 @@ local function git_fetch(host, path, repo, head)
return pack, wantedSha
end

function fetch(url, repo, head)
function fetch(url, repo, head, supress_progress)
if repo then assert(getmetatable(repo) == Repo, "arg #2 is not a repository") end
url = urllib.parse(url)
if url.scheme == 'git' then
local pack, sha = git_fetch(url.host, url.path, repo, head)
local pack, sha = git_fetch(url.host, url.path, repo, head, supress_progress)
return pack, sha
else
error('unsupported scheme: '..url.scheme)
Expand Down

0 comments on commit 9159006

Please sign in to comment.