aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar Klaus Aehlig <aehlig@google.com>2018-08-08 04:44:14 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-08-08 04:46:18 -0700
commitaf33d82884d69df89f83dc29f765d05c67605780 (patch)
treebec292c050660fe1f3cf3f04c79a64bc36f03d39 /tools
parent3a51b08a9572c88b3f9115c2404f65c829edaec9 (diff)
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
Diffstat (limited to 'tools')
-rw-r--r--tools/build_defs/repo/git.bzl3
1 files changed, 3 insertions, 0 deletions
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):