Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions lib/autobuild/import/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,18 @@ def initialize(repository, branch = nil, options = {})
with_submodules: false,
fingerprint_mode: Git.default_fingerprint_mode,
single_branch: Git.single_branch?,
shallow: Git.shallow?
shallow: nil
)
if gitopts[:shallow].nil? && Git.shallow?
# Support for shallow clones is limited ... do not auto-set it
# if we are in conditions where it will generate an error later
gitopts[:shallow] =
if gitopts[:tag]
gitopts[:single_branch]
else
!gitopts[:commit]
end
end

if gitopts[:branch] && branch
raise ConfigException, "git branch specified with both the option hash "\
Expand Down Expand Up @@ -1303,8 +1313,11 @@ def validate_shallow(package)
return false
end
if tag && !single_branch?
Autoproj.warn "#{package.name}: "\
"Cannot pin a tag while doing a shallow clone"
Autoproj.warn(
"#{package.name}: "\
"Cannot pin a tag while doing a shallow clone " \
"if single_branch is not set"
)
return false
end
if @remote_branch
Expand Down