From af33d82884d69df89f83dc29f765d05c67605780 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Wed, 8 Aug 2018 04:44:14 -0700 Subject: git.bzl: also clone branches with --depth=1 Cloning branches as added after the fact to the skylark git rules, once recording the actual commit was implemented. Still support shallow cloning also when following branches. Change-Id: Ib7a84de4ada69152e9e7c27e9d84cff39cfd3582 PiperOrigin-RevId: 207866303 --- tools/build_defs/repo/git.bzl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/build_defs/repo/git.bzl b/tools/build_defs/repo/git.bzl index 1e410df1d2..2ac8f4e116 100644 --- a/tools/build_defs/repo/git.bzl +++ b/tools/build_defs/repo/git.bzl @@ -29,12 +29,15 @@ def _clone_or_update(ctx): shallow = "--depth=1" else: ref = ctx.attr.branch + shallow = "--depth=1" directory = str(ctx.path(".")) if ctx.attr.strip_prefix: directory = directory + "-tmp" if ctx.attr.shallow_since: if ctx.attr.tag: fail("shallow_since not allowed if a tag is specified; --depth=1 will be used for tags") + if ctx.attr.branch: + fail("shallow_since not allowed if a branch is specified; --depth=1 will be used for branches") shallow = "--shallow-since=%s" % ctx.attr.shallow_since if (ctx.attr.verbose): -- cgit v1.2.3