diff options
author | Tom Scogland <scogland1@llnl.gov> | 2015-07-27 14:03:04 -0700 |
---|---|---|
committer | Tom Scogland <scogland1@llnl.gov> | 2015-07-27 14:03:04 -0700 |
commit | 9174c06598609241c1e6d66785e7aaeeb91e98a2 (patch) | |
tree | f88b18b4cb97e95d4019eb401db4b5c864190a94 | |
parent | 27ca697b43458c76fd7e079c2a6395fbb5b6126e (diff) | |
download | spack-9174c06598609241c1e6d66785e7aaeeb91e98a2.tar.gz spack-9174c06598609241c1e6d66785e7aaeeb91e98a2.tar.bz2 spack-9174c06598609241c1e6d66785e7aaeeb91e98a2.tar.xz spack-9174c06598609241c1e6d66785e7aaeeb91e98a2.zip |
adding a fallback on failure with git --depth
Certain remote protocols don't support the `--depth` option. Since this can't
be checked by URL type or in any sane way locally, this version attempts to
clone git repositories with the --depth option, and if that fails attempts the
clone again without it.
-rw-r--r-- | lib/spack/spack/fetch_strategy.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py index 0ba0251caa..b810023c5a 100644 --- a/lib/spack/spack/fetch_strategy.py +++ b/lib/spack/spack/fetch_strategy.py @@ -425,12 +425,21 @@ class GitFetchStrategy(VCSFetchStrategy): if self.git_version > ver('1.7.10'): args.append('--single-branch') + cloned = False # Yet more efficiency, only download a 1-commit deep tree if self.git_version >= ver('1.7.1'): - args.extend(['--depth','1']) + try: + self.git(*(args + ['--depth','1', self.url])) + cloned = True + except spack.error.SpackError: + # This will fail with the dumb HTTP transport + # continue and try without depth, cleanup first + pass + + if not cloned: + args.append(self.url) + self.git(*args) - args.append(self.url) - self.git(*args) self.stage.chdir_to_source() # For tags, be conservative and check them out AFTER |