Make Git repository rules compatible with older Git versions.
CentOS 7 includes git 1.8.3.1, which needs an explicit destination ref
in the refspec passed to fetch, otherwise it doesn't create a local ref,
so the `git reset origin/<branch>` later would fail.
@@ -68,7 +68,7 @@ def git_repo(ctx, directory):
fetch_ref = "tags/" + ctx.attr.tag + ":tags/" + ctx.attr.tag
elif ctx.attr.branch:
reset_ref = "origin/" + ctx.attr.branch
- fetch_ref = ctx.attr.branch
+ fetch_ref = ctx.attr.branch + ":origin/" + ctx.attr.branch
git_repo = _GitRepoInfo(
directory = ctx.path(directory),
