[geos-commits] [SCM] GEOS branch main updated. 493bfff3b8f4f4e356820bbf22e41b64d7077cc5

git at osgeo.org git at osgeo.org
Fri Sep 11 04:48:56 PDT 2026


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".

The branch, main has been updated
       via  493bfff3b8f4f4e356820bbf22e41b64d7077cc5 (commit)
      from  979185683c608440f7dc36cec1474a5c2ab90b8a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 493bfff3b8f4f4e356820bbf22e41b64d7077cc5
Author: Sandro Santilli <strk at kbt.io>
Date:   Mon Aug 31 05:27:20 2026 +0000

    Expose revision-level version information
    
    Adds:
      - GEOS_REVISION in version.h header
      - GEOSrevision() CAPI function,
      - geos-config --revision switch
    
    Includes unit test
    
    Closes GH-1446

diff --git a/.gitignore b/.gitignore
index 9d8abedec..60c481cfb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
 aclocal.m4
 Makefile.in
 Makefile
+Testing
 .libs
 .deps
 .vimrc
@@ -53,6 +54,7 @@ src/cmake_install.cmake
 src/deps/cmake_install.cmake
 tests/CTestTestfile.cmake
 tests/cmake_install.cmake
+tests/fuzz/cmake_install.cmake
 tests/unit/CTestTestfile.cmake
 tests/unit/cmake_install.cmake
 tests/xmltester/CTestTestfile.cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 541288b93..865995778 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -78,6 +78,38 @@ message(STATUS "GEOS: Version ${GEOS_VERSION}")
 message(STATUS "GEOS: C API Version ${CAPI_VERSION}")
 message(STATUS "GEOS: JTS port ${JTS_PORT}")
 
+# Generate revision information from git
+execute_process(
+  COMMAND git describe --tags --always
+  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+  OUTPUT_VARIABLE _git_describe
+  ERROR_VARIABLE _git_describe_err
+)
+# Strip any trailing newline/whitespace from the description
+string(STRIP "${_git_describe}" _git_describe_stripped)
+
+set(GEOS_REVISION "${_git_describe_stripped}" CACHE STRING "git describe output")
+
+# Check if the working tree is dirty
+execute_process(
+  COMMAND git diff --quiet
+  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+  RESULT_VARIABLE _diff_rc
+)
+if(NOT _diff_rc EQUAL 0)
+  set(GEOS_REVISION "${GEOS_REVISION} (dirty)")
+else()
+  # Also check for untracked files
+  execute_process(
+    COMMAND git status --porcelain
+    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+    OUTPUT_VARIABLE _status
+  )
+  if(_status MATCHES "\\?\\?")
+    set(GEOS_REVISION "${GEOS_REVISION} (dirty)")
+  endif()
+endif()
+
 if(CMAKE_VERSION VERSION_LESS 3.21)
   if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
     set(PROJECT_IS_TOP_LEVEL ON)
diff --git a/NEWS.md b/NEWS.md
index f3b920928..a42c4db2f 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -4,6 +4,10 @@
 - Fixes/Improvements:
   -
 
+- New things:
+  - Expose code revision: GEOS_REVISION, GEOSrevision, geos-config --revision
+    (GH-1446 Sandro Santilli)
+
 ## Changes in 3.15.0
 2026-09-01
 
diff --git a/capi/geos_c.h.in b/capi/geos_c.h.in
index 8121146ba..19ec83cd0 100644
--- a/capi/geos_c.h.in
+++ b/capi/geos_c.h.in
@@ -69,6 +69,9 @@ extern "C" {
 #ifndef GEOS_VERSION
 #define GEOS_VERSION "@VERSION@"
 #endif
+#ifndef GEOS_REVISION
+#define GEOS_REVISION "@GEOS_REVISION@"
+#endif
 #ifndef GEOS_JTS_PORT
 #define GEOS_JTS_PORT "@JTS_PORT@"
 #endif
@@ -2537,6 +2540,15 @@ extern void GEOS_DLL GEOSFree_r(
 */
 extern const char GEOS_DLL *GEOSversion(void);
 
+/**
+* Returns the current GEOS revision string. eg: "3.15.0rc1-3-g952699419 (dirty)"
+* This function does not have a reentrant variant and is
+* available if `GEOS_USE_ONLY_R_API` is defined.
+* \return revision string
+* \since 3.15
+*/
+extern const char GEOS_DLL *GEOSrevision(void);
+
 /*
 * External code to GEOS can define GEOS_USE_ONLY_R_API
 * to strip the non-reentrant API functions from this header,
@@ -3205,7 +3217,7 @@ extern const GEOSGeometry GEOS_DLL *GEOSGetGeometryN(
 
 /**
 * Returns the number of simple curves in a CompoundCurve.
-* Returns 1 for a non-empty LineString/CircularString, and 0 
+* Returns 1 for a non-empty LineString/CircularString, and 0
 * for other inputs.
 * \param g Input geometry
 * \return Number of child curves in this geometry
@@ -4787,7 +4799,7 @@ extern int GEOS_DLL GEOSBufferParams_setSingleSided(
 
 /**
 * Generates a buffer using the special parameters in the GEOSBufferParams
-* 
+*
 * @INPUT_CURVES_CONVERTED_TO_LINES@
 *
 * \param g The geometry to buffer
@@ -5600,8 +5612,8 @@ extern GEOSGeometry GEOS_DLL * GEOSVoronoiDiagram(
 extern GEOSGeometry GEOS_DLL *GEOSNode(const GEOSGeometry* g);
 
 
-/** Split a linear or polygonal input 
-* 
+/** Split a linear or polygonal input
+*
 * Linear inputs can be split with points, lines, and/or polygons.
 * Polygons can be split with lines and/or polygons.
 *
@@ -5758,7 +5770,7 @@ extern GEOSGeometry GEOS_DLL *GEOSBuildArea(const GEOSGeometry* g);
 * evenly subdivide that segment. Z and M values of added
 * vertices will be interpolated.
 * Only linear components of input geometry are densified.
-* 
+*
 * Curved geometries are not supported, unless curve-to-line parameters are
 * registered with the context handle. Output geometries will not contain
 * curves.
@@ -6077,7 +6089,7 @@ extern GEOSGeometry GEOS_DLL *GEOSGeom_setPrecision(
 *           NULL on exception
 *
 *   \since 3.15
-*/ 
+*/
 extern GEOSGeometry GEOS_DLL *GEOSCurveToLine(
     const GEOSGeometry* g,
     const GEOSCurveToLineParams* params);
@@ -6093,7 +6105,7 @@ extern void GEOS_DLL GEOSCurveToLineParams_destroy(GEOSCurveToLineParams* params
 *   \return 1 if the operation succeeded, 0 otherwise
 *
 *   \since 3.15
-*/ 
+*/
 extern int GEOS_DLL GEOSCurveToLineParams_setMaxStepDegrees(
     GEOSCurveToLineParams* params,
     double tolerance);
@@ -6105,7 +6117,7 @@ extern int GEOS_DLL GEOSCurveToLineParams_setMaxStepDegrees(
 *   \return 1 if the operation succeeded, 0 otherwise
 *
 *   \since 3.15
-*/ 
+*/
 extern int GEOS_DLL GEOSCurveToLineParams_setMaxDeviation(
     GEOSCurveToLineParams* params,
     double tolerance);
@@ -6119,7 +6131,7 @@ extern int GEOS_DLL GEOSCurveToLineParams_setMaxDeviation(
 *           NULL on exception
 *
 *   \since 3.15
-*/ 
+*/
 extern GEOSGeometry GEOS_DLL *GEOSLineToCurve(
     const GEOSGeometry* g,
     const GEOSLineToCurveParams* params);
@@ -6133,7 +6145,7 @@ extern void GEOS_DLL GEOSLineToCurveParams_destroy(GEOSLineToCurveParams* params
 *   A vertex may be considered to continue a circular arc if its distance to the
 *   previously-computed circle center is within the specified fraction of the
 *   circle radius.
-* 
+*
 *   \param params the parameters object
 *   \param tolerance the tolerance value
 *   \return 1 on success, 0 on failure
@@ -6149,7 +6161,7 @@ extern int GEOS_DLL GEOSLineToCurveParams_setRadiusTolerance(
 *   the point and the final point in the arc is less than the specified
 *   tolerance. Because of round-off errors, this value should be slightly
 *   greater than the one used in \ref GEOSCurveToLineParams_setMaxStepDegrees.
-* 
+*
 *   \param params the parameters object
 *   \param tolerance the tolerance value
 *   \return 1 on success, 0 on failure
@@ -6165,9 +6177,9 @@ extern int GEOS_DLL GEOSLineToCurveParams_setMaxStepDegrees(
 *   the point and the final point in the arc is within the specified
 *   tolerance of the angle calculated when the final point in the arc was
 *   added. This tolerance can be used to ensure that the step spacing is
-*   regular, which is an indication of a line that was generated by 
+*   regular, which is an indication of a line that was generated by
 *   linearizing a curve.
-* 
+*
 *   \param params the parameters object
 *   \param tolerance the tolerance value
 *   \return 1 on success, 0 on failure
diff --git a/capi/geos_ts_c.cpp b/capi/geos_ts_c.cpp
index eaccf1739..179015f24 100644
--- a/capi/geos_ts_c.cpp
+++ b/capi/geos_ts_c.cpp
@@ -3190,6 +3190,13 @@ extern "C" {
         return version;
     }
 
+    const char* GEOSrevision()
+    {
+        static char rev[256];
+        snprintf(rev, 256, "%s", GEOS_REVISION);
+        return rev;
+    }
+
     const char* GEOSjtsport()
     {
         return GEOS_JTS_PORT;
diff --git a/include/geos/version.h.in b/include/geos/version.h.in
index 104f0173d..ecaca0b96 100644
--- a/include/geos/version.h.in
+++ b/include/geos/version.h.in
@@ -30,6 +30,9 @@
 #define GEOS_VERSION "@VERSION@"
 #endif
 
+/* Revision-level version information */
+#define GEOS_REVISION "@GEOS_REVISION@"
+
 #ifndef GEOS_JTS_PORT
 #define GEOS_JTS_PORT "@JTS_PORT@"
 #endif
diff --git a/tests/unit/capi/GEOSCAPIDefinesTest.cpp b/tests/unit/capi/GEOSCAPIDefinesTest.cpp
index b86c8fe1c..68e6c9c94 100644
--- a/tests/unit/capi/GEOSCAPIDefinesTest.cpp
+++ b/tests/unit/capi/GEOSCAPIDefinesTest.cpp
@@ -60,5 +60,14 @@ void object::test<3>
     ensure_equals(GEOS_CAPI_VERSION, std::string(GEOSversion()));
 }
 
+// Make sure revision define is consistent with function
+template<>
+template<>
+void object::test<4>
+()
+{
+    ensure_equals(GEOS_REVISION, std::string(GEOSrevision()));
+}
+
 } // namespace tut
 
diff --git a/tools/geos-config.in b/tools/geos-config.in
index c04b5957e..f61b4e930 100644
--- a/tools/geos-config.in
+++ b/tools/geos-config.in
@@ -12,6 +12,7 @@ Usage: geos-config [OPTIONS]
 Options:
      [--prefix]
      [--version]
+     [--revision]
      [--libs]
      [--clibs]
      [--cclibs]
@@ -41,6 +42,9 @@ while test $# -gt 0; do
     --version)
       echo @VERSION@
       ;;
+    --revision)
+      echo "@GEOS_REVISION@"
+      ;;
     --libs)
       # TODO: make an alias for --clibs
       # see http://trac.osgeo.org/geos/ticket/497

-----------------------------------------------------------------------

Summary of changes:
 .gitignore                              |  2 ++
 CMakeLists.txt                          | 32 +++++++++++++++++++++++++++
 NEWS.md                                 |  4 ++++
 capi/geos_c.h.in                        | 38 ++++++++++++++++++++++-----------
 capi/geos_ts_c.cpp                      |  7 ++++++
 include/geos/version.h.in               |  3 +++
 tests/unit/capi/GEOSCAPIDefinesTest.cpp |  9 ++++++++
 tools/geos-config.in                    |  4 ++++
 8 files changed, 86 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list