From ad68d5cdf2662f9ac27b53a869512fda675e2306 Mon Sep 17 00:00:00 2001
From: Thorge Petersen <petersen@rz.uni-kiel.de>
Date: Thu, 8 Jun 2023 12:58:55 +0200
Subject: [PATCH] Removed the functionality that retrieved the current commit
 hash of the checked out Git repository for the extension

---
 CHANGELOG.md                                        |  1 +
 ckanext/odsh/helpers.py                             | 13 -------------
 ckanext/odsh/plugin.py                              |  1 -
 .../api/resource_qv4yAI2rgotamXGk98gJ.html          |  1 -
 4 files changed, 1 insertion(+), 15 deletions(-)
 delete mode 100644 ckanext/odsh/templates/api/resource_qv4yAI2rgotamXGk98gJ.html

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 456d020a..2cfd25fa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 ### Removed
 
 - Removed Travis CI 'bin/' directory, along with all associated Travis CI configuration files and scripts.
+- Removed the functionality that retrieved the current commit hash of the checked out Git repository for the extension. The commit hash was previously inserted into a custom API resource to provide external developers repository information.
 
 ### Changed
 
diff --git a/ckanext/odsh/helpers.py b/ckanext/odsh/helpers.py
index ddcea24e..5323377b 100644
--- a/ckanext/odsh/helpers.py
+++ b/ckanext/odsh/helpers.py
@@ -253,19 +253,6 @@ def odsh_public_resource_url(res):
         return res['url']
 
 
-def odsh_get_version_id():
-    try:
-        home = config.get('ckanext.odsh.home', '/usr/lib/ckan/default/src/ckanext-odsh')
-        if home:
-            if home[-1] == '/':
-                home = home[:-1]
-            home += '/.git'
-            return subprocess.check_output(["git", "--git-dir", home, "rev-parse", "HEAD"]).strip()
-    except:
-        return 'unknown'
-    return 'unknown'
-
-
 def odsh_show_testbanner():
     return config.get('ckanext.odsh.showtestbanner', False) == True
 
diff --git a/ckanext/odsh/plugin.py b/ckanext/odsh/plugin.py
index 45341ea9..998aac33 100644
--- a/ckanext/odsh/plugin.py
+++ b/ckanext/odsh/plugin.py
@@ -323,7 +323,6 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
                 'odsh_public_url': odsh_helpers.odsh_public_url,
                 'odsh_spatial_extends_available': odsh_helpers.spatial_extends_available,
                 'odsh_public_resource_url': odsh_helpers.odsh_public_resource_url,
-                'odsh_get_version_id': odsh_helpers.odsh_get_version_id,
                 'odsh_show_testbanner': odsh_helpers.odsh_show_testbanner,
                 'tpsh_get_daterange_prettified': helper_pkg_dict.get_daterange_prettified,
                 'tpsh_get_language_of_package': helpers_tpsh.get_language_of_package,
diff --git a/ckanext/odsh/templates/api/resource_qv4yAI2rgotamXGk98gJ.html b/ckanext/odsh/templates/api/resource_qv4yAI2rgotamXGk98gJ.html
deleted file mode 100644
index 2ba851cb..00000000
--- a/ckanext/odsh/templates/api/resource_qv4yAI2rgotamXGk98gJ.html
+++ /dev/null
@@ -1 +0,0 @@
-{{ h.odsh_get_version_id()}}
\ No newline at end of file
-- 
GitLab