From 8f65a7b767a19ffbd76f5030ba64ca0219d5f4c7 Mon Sep 17 00:00:00 2001
From: mpeterv <mpeterval@gmail.com>
Date: Fri, 10 Jul 2015 22:00:59 +0300
Subject: Fix git cloning command when using git+http protocol

git+http and git+https pass '--' instead of '--depth=1' option.
As '--branch' option was passed after depth, it caused the former
to be interpreted as an extra argument by git. Pass '--branch' first
instead.
---
 src/luarocks/fetch/git.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/luarocks/fetch/git.lua b/src/luarocks/fetch/git.lua
index e540d696..a635f190 100644
--- a/src/luarocks/fetch/git.lua
+++ b/src/luarocks/fetch/git.lua
@@ -68,7 +68,7 @@ function git.get_sources(rockspec, extract, dest_dir, depth)
       if git_can_clone_by_tag(git_cmd) then
          -- The argument to `--branch` can actually be a branch or a tag as of
          -- Git 1.7.10.
-         table.insert(command, 4, "--branch=" .. tag_or_branch)
+         table.insert(command, 3, "--branch=" .. tag_or_branch)
       end
    end
    if not fs.execute(unpack(command)) then
-- 
cgit v1.2.3-55-g6feb