No Wayman <iarchivedmywholel...@gmail.com> writes:

> Feel free to take this the patch as a base to do whatever you 
> please with it.

Then, I am thinking about a simple approach that will not involve
internet connection. See the attached.

Note that you, in fact, can fetch the latest tags from remote into
shallow clone. See
https://stackoverflow.com/questions/66349002/get-latest-tag-git-describe-tags-when-repo-is-cloned-with-depth-1

>From 93a75bcd3f8badf11c9234e5336e450d2d2baf60 Mon Sep 17 00:00:00 2001
Message-Id: <93a75bcd3f8badf11c9234e5336e450d2d2baf60.1674218582.git.yanta...@posteo.net>
From: Ihor Radchenko <yanta...@posteo.net>
Date: Fri, 20 Jan 2023 15:25:33 +0300
Subject: [PATCH] * mk/targets.mk(GITVERSION): Provide commit number for
 shallow clones

Fall back to using git log when git describe fails in Org repo.

See https://orgmode.org/list/87bkmve8qv....@gmail.com
---
 mk/targets.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mk/targets.mk b/mk/targets.mk
index 4435daa..164b092 100644
--- a/mk/targets.mk
+++ b/mk/targets.mk
@@ -14,7 +14,7 @@ ifneq ($(wildcard .git),)
   # Use the org.el header.
   ORGVERSION := $(patsubst %-dev,%,$(shell $(BATCH) --eval "(require 'lisp-mnt)" \
     --visit lisp/org.el --eval '(princ (lm-header "version"))'))
-  GITVERSION ?= $(shell git describe --match release\* --abbrev=6 HEAD)
+  GITVERSION ?= $(shell git describe --match release\* --abbrev=6 HEAD 2>/dev/null || echo  "release_N/A-N/A-$(shell git log --format=%h HEAD^..HEAD)")
   GITSTATUS  ?= $(shell git status -uno --porcelain)
 else
  -include mk/version.mk
-- 
2.39.1

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to