diff --git a/master_changes.md b/master_changes.md index ed0ff667171..9c4975018f5 100644 --- a/master_changes.md +++ b/master_changes.md @@ -33,6 +33,7 @@ users) * Make fetching an archive from cache add missing symlinks [#6068 @kit-ty-kate - fix #6064] * [BUG] Fix `opam install --deps-only` set direct dependencies as root packages [#6125 @rjbou] * [BUG] Fix `opam install --check pkg` when pkg depends on a non-existing package [#6121 @kit-ty-kate] + * Disable shallow clone by default except for opam repositories [#6146 @kit-ty-kate - fix #6145] ## Build (package) * ◈ Add `--verbose-on` option to enable verbose mode on specified package names [#5682 @desumn @rjbou] @@ -195,6 +196,7 @@ users) ## opam-repository * `OpamRepository.fetch_from_cache`: when an archive is found, add a symlink (or copy) for the ones found in opam file but not in cache [#6068 @kit-ty-kate] + * `?full_fetch` is now `true` by default instead of `false` [#6146 @kit-ty-kate - fix #6145] ## opam-state * `OpamStateConfig.opamroot_with_provenance`: restore previous behaviour to `OpamStateConfig.opamroot` for compatibility with third party code [#6047 @dra27] diff --git a/src/repository/opamGit.ml b/src/repository/opamGit.ml index c30f66a3162..49980641c77 100644 --- a/src/repository/opamGit.ml +++ b/src/repository/opamGit.ml @@ -62,7 +62,7 @@ module VCS : OpamVCS.VCS = struct | Some h -> "refs/remotes/opam-ref-"^h | None -> "refs/remotes/opam-ref" - let fetch ?(full_fetch = false) ?cache_dir ?subpath repo_root repo_url = + let fetch ?(full_fetch = true) ?cache_dir ?subpath repo_root repo_url = (match subpath with | Some sp -> git repo_root [ "config"; "--local"; "core.sparseCheckout"; "true" ] diff --git a/src/repository/opamRepository.mli b/src/repository/opamRepository.mli index f66a3a73c2e..babd92c3127 100644 --- a/src/repository/opamRepository.mli +++ b/src/repository/opamRepository.mli @@ -43,8 +43,8 @@ val pull_shared_tree: url list -> string download OpamProcess.job (* Same as [pull_shared_tree], but for a unique label/dirname. - If [full_fetch] is true, VCS repository is retrieved with full history (by - default, no history). *) + If [full_fetch] is set to false, VCS repository is retrieved with shallow + history (by default, full history). *) val pull_tree: string -> ?full_fetch:bool -> ?cache_dir:dirname -> ?cache_urls:url list -> ?working_dir:bool -> ?subpath:subpath -> diff --git a/src/repository/opamRepositoryBackend.mli b/src/repository/opamRepositoryBackend.mli index dcdb62fae1d..7d51025a6f7 100644 --- a/src/repository/opamRepositoryBackend.mli +++ b/src/repository/opamRepositoryBackend.mli @@ -45,8 +45,8 @@ module type S = sig [checksum] can be used for retrieval but is NOT checked by this function. - If [full_fetch] is set to true, VCS repository is retrieved with full - history (by default, no history). + If [full_fetch] is set to false, VCS repository is retrieved with shallow + history (by default, full history). If [cache_dir] is given, the directory is used by VCS tool as a its cache directory. If [subpath] is given, only that [subpath] of the url is retrieved. *) diff --git a/src/repository/opamVCS.mli b/src/repository/opamVCS.mli index 3a1d709ae29..d8fd5633dc8 100644 --- a/src/repository/opamVCS.mli +++ b/src/repository/opamVCS.mli @@ -29,8 +29,8 @@ module type VCS = sig Be aware that the remote URL might have been changed, so make sure to update accordingly. - If [full_fetch] is set to true, VCS repository is retrieved with full - history (by default, no history). + If [full_fetch] is set to false, VCS repository is retrieved with shallow + history (by default, full history). If [cache_dir] is given, the directory is used by VCS tool as a its cache directory. If [subpath] is given, only that [subpath] of the url is retrieved. *) diff --git a/tests/reftests/fetch-package.test b/tests/reftests/fetch-package.test index 9966ba3f92a..652229a8561 100644 --- a/tests/reftests/fetch-package.test +++ b/tests/reftests/fetch-package.test @@ -87,7 +87,7 @@ Done. opam root.ml ### cat OPAM/downloads-repo/lib/foo-git-hist -1 +2 ### :: pinning ### opam switch create downloads-pin --empty ### opam pin foo-arch-pin arch.tgz -y @@ -124,7 +124,7 @@ Done. opam root.ml ### cat OPAM/downloads-pin/lib/foo-git-pin-hist -1 +2 ### :: dev-repo ### opam switch create downloads-devrepo --empty ### opam pin foo-git --dev-repo -y @@ -143,4 +143,4 @@ Done. opam root.ml ### cat OPAM/downloads-devrepo/lib/foo-git-hist -1 +2 diff --git a/tests/reftests/source.test b/tests/reftests/source.test index e75374635f3..e1c5e3999bb 100644 --- a/tests/reftests/source.test +++ b/tests/reftests/source.test @@ -132,7 +132,7 @@ Now run 'opam upgrade' to apply any package updates. ### opam source pandore.4 --dir pandore5 Successfully extracted to ${BASEDIR}/pandore5 ### git -C pandore5 rev-list --all --count -1 +2 ### opam source pandore.4 --dev --dir pandore6 Successfully fetched pandore development repo to ${BASEDIR}/pandore6 ### git -C pandore6 rev-list --all --count