Ihor Radchenko <yanta...@posteo.net> writes:
No Wayman <iarchivedmywholel...@gmail.com> writes:
Ihor Radchenko <yanta...@posteo.net> writes:
What we should not have is "make autoloads" failing without
internet.
The attached patch should take care of that.
If the ls-remote errors, GITVERSION will be set to N/A as when
it
is generally unavailable.
I just tried your patch running make without internet. I got the
following Org version:
Subject: [BUG] test [9.6.1 ( @ /tmp/org-mode/lisp/)]
As you can see, the last commit number is not listed even though
I can
see it via git log.
The attached patch should take care of that.
>From 872ba4bf04313692758bcb3d8622c16bbd407101 Mon Sep 17 00:00:00 2001
From: Nicholas Vollmer <iarchivedmywholel...@gmail.com>
Date: Mon, 16 Jan 2023 14:00:41 -0500
Subject: [PATCH] * mk/targets.mk (GITVERSION): support shallow repo clones
If Org is being built from a shallow clone, tags are not locally available.
Query the upstream remote via git ls-remote and parse the output.
Note this will result in a "n/a" indicator in org-version where the
number of commits since the last tag is usually present.
e.g. "release_9.6.1-n/a-gabc123"
---
mk/targets.mk | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/mk/targets.mk b/mk/targets.mk
index 4435daa9..ca6d8c42 100644
--- a/mk/targets.mk
+++ b/mk/targets.mk
@@ -14,7 +14,20 @@ 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)
+ ifneq ($(wildcard .git/shallow),)
+ REMOTETAGS := $(strip $(shell git ls-remote --tags 2>/dev/null | tail -n 1))
+ COMMIT := $(shell git rev-parse --short=6 HEAD)
+ TAG := $(lastword $(REMOTETAGS))
+ ifneq ($(TAG),)
+ TAGPREFIX := $(subst refs/tags/,,$(TAG))
+ GITVERSION ?= $(subst ^{},-n/a-g$(COMMIT), $(TAGPREFIX))
+ else
+ GITVERSION ?= $(ORGVERSION)-n/a-g$(COMMIT)
+ endif
+ else
+ GITVERSION ?= $(shell git describe --match release\* --abbrev=6 HEAD)
+ endif
+ GITVERSION ?= N/A
GITSTATUS ?= $(shell git status -uno --porcelain)
else
-include mk/version.mk
--
2.39.0