diff --git a/tests/test_server.py b/tests/test_server.py index 71a0b1bb..6debf06a 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -375,7 +375,7 @@ def test_server_export_remote(): dep_commit = GitRepo(Repo("application-blueprint/std")).revision etag = server._make_etag(hex(int(last_commit, 16) - ^ int(get_package_digest(True), 16) + ^ int(get_package_digest(), 16) ^ int(dep_commit, 16))) # # check that this public project (no auth header sent) was cached res = requests.get( diff --git a/unfurl/server/serve.py b/unfurl/server/serve.py index cbdc2e4b..2761eafc 100644 --- a/unfurl/server/serve.py +++ b/unfurl/server/serve.py @@ -500,7 +500,7 @@ class CacheValue(NamedTuple): last_commit_date: int def make_etag(self) -> str: - etag = int(self.last_commit, 16) ^ int(get_package_digest(True) or "0", 16) + etag = int(self.last_commit, 16) ^ int(get_package_digest() or "0", 16) for dep in self.deps.values(): for last_commit in dep.last_commits: if last_commit: diff --git a/unfurl/util.py b/unfurl/util.py index efce2fbc..3c057538 100644 --- a/unfurl/util.py +++ b/unfurl/util.py @@ -72,7 +72,7 @@ _package_digest: Optional[str] = None -def get_package_digest(commit_only=False) -> str: +def get_package_digest() -> str: global _package_digest if _package_digest is not None: return _package_digest @@ -82,11 +82,8 @@ def get_package_digest(commit_only=False) -> str: basedir = os.path.dirname(_basepath) if os.path.isdir(os.path.join(basedir, ".git")): repo = Repo(basedir) - if commit_only: - # same as pbr's git_version - _package_digest = repo.git.log(n=1, pretty="format:%h") - else: - _package_digest = repo.git.describe("--dirty", "--always", "--match=v*") + # same as pbr's git_version + _package_digest = repo.git.log(n=1, pretty="format:%h") else: _package_digest = "" pkg_files = files("unfurl")