Skip to content

Commit 7249bb8

Browse files
KristofferCKristofferC
authored andcommitted
fall back to fetching more refspects in case the restricted set doesnt find the rev (#4441)
(cherry picked from commit 1f09191)
1 parent 9e74726 commit 7249bb8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Types.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,7 @@ function read_package(path::String)
721721
end
722722

723723
const refspecs = ["+refs/heads/*:refs/remotes/cache/heads/*"]
724+
const refspecs_fallback = ["+refs/*:refs/remotes/cache/*"]
724725

725726
function relative_project_path(project_file::String, path::String)
726727
# compute path relative the project
@@ -932,6 +933,11 @@ function handle_repo_add!(ctx::Context, pkg::PackageSpec)
932933
fetched = true
933934
GitTools.fetch(ctx.io, repo, repo_source_typed; refspecs=refspecs)
934935
obj_branch = get_object_or_branch(repo, rev_or_hash)
936+
# If still not found, try with broader refspec as fallback
937+
if obj_branch === nothing
938+
GitTools.fetch(ctx.io, repo, repo_source_typed; refspecs = refspecs_fallback)
939+
obj_branch = get_object_or_branch(repo, rev_or_hash)
940+
end
935941
if obj_branch === nothing
936942
pkgerror("Did not find rev $(rev_or_hash) in repository")
937943
end

0 commit comments

Comments
 (0)