From 09355701f6e04142085cb18d69e65e658d146f83 Mon Sep 17 00:00:00 2001 From: Jeremy Cohen Date: Wed, 29 Nov 2023 08:40:47 +0100 Subject: [PATCH] Restore warning on unpinned git packages (#9157) --- core/dbt/deps/git.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/dbt/deps/git.py b/core/dbt/deps/git.py index 4f8c3ba376f..ad9fc837cd2 100644 --- a/core/dbt/deps/git.py +++ b/core/dbt/deps/git.py @@ -101,11 +101,14 @@ def _fetch_metadata( self, project: Project, renderer: PackageRenderer ) -> ProjectPackageMetadata: path = self._checkout() - # overwrite 'revision' with actual commit SHA - self.revision = git.get_current_sha(path) + # raise warning (or error) if this package is not pinned if (self.revision == "HEAD" or self.revision in ("main", "master")) and self.warn_unpinned: - warn_or_error(DepsUnpinned(git=self.git)) + warn_or_error(DepsUnpinned(revision=self.revision, git=self.git)) + + # now overwrite 'revision' with actual commit SHA + self.revision = git.get_current_sha(path) + partial = PartialProject.from_project_root(path) return partial.render_package_metadata(renderer)