From a259084c50cdb692a6ba6818bb56ee381e67715b Mon Sep 17 00:00:00 2001 From: Andrew Brooks Date: Fri, 14 Oct 2022 18:04:47 -0500 Subject: [PATCH] Fix #7146 When fetching a non-local git repo by ref (and no rev), don't consider unrelated cached revs for the same repository. --- src/libfetchers/git.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libfetchers/git.cc b/src/libfetchers/git.cc index c1a21e764..7b7a1be35 100644 --- a/src/libfetchers/git.cc +++ b/src/libfetchers/git.cc @@ -485,6 +485,10 @@ struct GitInputScheme : InputScheme } input.attrs.insert_or_assign("ref", *head); unlockedAttrs.insert_or_assign("ref", *head); + } else { + if (!input.getRev()) { + unlockedAttrs.insert_or_assign("ref", input.getRef().value()); + } } if (auto res = getCache()->lookup(store, unlockedAttrs)) {