Allow shallow git registries#37
Conversation
'git fetch' normally refuses to deal with shallow repositories. For vcpkg, this makes it impossible to use shallow clones of remote registries such as 'VCPKG_INSTALLATION_ROOT' on Azure Pipelines. An extra parameter makes 'git fetch' accept shallow repositories.
51ec8dc to
58a0678
Compare
| git_cmd_builder(*this, dot_git_dir, work_tree).string_arg("fetch").string_arg("--").string_arg(repo); | ||
| System::Command fetch_git_ref = git_cmd_builder(*this, dot_git_dir, work_tree) | ||
| .string_arg("fetch") | ||
| .string_arg("--update-shallow") |
There was a problem hiding this comment.
| .string_arg("--update-shallow") | |
| .string_arg("--unshallow") |
Since git repos reference tree objects in the history, we need the full history available.
There was a problem hiding this comment.
The point is: For a shallow clone such as VCPK_INSTALLATION_ROOT in Azure Pipelines, one would need to unshallow the clone at VCPKG_INSTALLATION_ROOT. You cannot apply --unshallow when fetching from the shallow clone.
Since git repos reference tree objects in the history, we need the full history available.
I'm not a git tree object expert. Anyway, do you really always need the full history, or just enough depth to resolve the references for the desired ports and versions?
|
FWIW, the proposed patch works for me with A full successful build of #35 + #37 is at A failed attempt with |
|
I don't have a strong opinion about whether shallow repository support is really needed. But at least the error reporting could be improved. For Azure Pipelines, the repository at However, AFAIU, it cannot be used as a filesystem registry, because it provides |
|
I see, sorry, I misunderstood the situation! To restate for future readers: you're using a pre-cloned, shallow repo as a git registry. Therefore, when we attempt to fetch the registry into the local registry git, fetch fails because it doesn't want to fetch from a shallow registry (the current registry is importantly not shallow). Therefore, This solution LGTM given the problem! Thanks! |
The following PRs are included: * hopefully fix crash in constraints (#60) * [vcpkg] allow --version to check the version (#50) * Remove baseline warning (#27) * [git] always pass autocrlf=false (#58) * ignore QtCreator CMake project files (#54) * ignore .DS_store files (#53) * [vcpkg] x-add-version now also checks if the manifest file is properly formatted (#43) * hopefully fix ci issue #16773 (#34) * Add docs to set VCPKG_ROOT to run tests (#45) * [vcpkg] x-add-version improve speed by calling get_builtin_baseline only once (#44) * add clang-format version to format-cxxcode (#41) * [vcpkg] Introduce experimental workaround X_VCPKG_NUGET_ID_PREFIX (#40) * [supports] Add `native` identifier expression and x-check-support command (#29) * [metrics] Split reporting of installs into name:triplet (#39) * [vcpkg] Improve error when accessing missing feature (#38) * [vcpkg] Allow shallow git registries (#37) * Disable git autocrlf when archiving tree (#36) * Use only named packages from extra registries (#35) * [registries] add metrics (#30) * Add vcpkg policy cmake helper port support (#17) * [osx] add support for rosetta (#23) * don't build tls12-download unless it's needed (#33) * Add new telemetry points for versioning (#21) * add cmake_minimum_required to vcpkg_tags (#25) * [x-add-versions] Perform atomic replacement of versioning files (#28) * [tools] support gsutil (#19) * add CUDA 11.1 and 11.2 to KEEP_ENV_VARS defaults (#26) * Add finite timeout on CURL metrics endpoint. (#22) * fix UB in make_error_code(utf8_errc) (#18)
git fetchnormally refuses to deal with shallow repositories.For vcpkg, this makes it impossible to use shallow clones of remote
registries such as
VCPKG_INSTALLATION_ROOTon Azure Pipelines.An extra parameter makes
git fetchaccept shallow repositories.