all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Support building Org from shallow clone [9.6.1 (release_9.6.1-137-gecb62e @ /home/n/.emacs.d/elpaca/builds/org/)]
@ 2023-01-15 20:01 No Wayman
  2023-01-15 20:55 ` No Wayman
  2023-01-16 13:38 ` Ihor Radchenko
  0 siblings, 2 replies; 14+ messages in thread
From: No Wayman @ 2023-01-15 20:01 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 557 bytes --]


In order to properly generate org-version.el, the current build in 
mk/targets.mk requires a query of the repo's tags. Shallow clones 
do not have tags and so org-version will be generated as "N/A". In 
the attached patch, support for generating org-version.el from 
shallow clones is added. It is done by querying the upstream 
remote via git ls-remote and parsing the output. In this case, a 
more well formed org-version string will be generated. However, it 
will be missing the "commits since last tag" information. e.g.

"release_9.6.1-n/a-gabc123"


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-mk-targets.mk-GITVERSION-support-shallow-repo-clones.patch --]
[-- Type: text/x-patch, Size: 1544 bytes --]

From 28c596320f48e4606f8eaf69fdc1c83fb084749e Mon Sep 17 00:00:00 2001
From: Nicholas Vollmer <iarchivedmywholelife@gmail.com>
Date: Sun, 15 Jan 2023 14:55:11 -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 | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/mk/targets.mk b/mk/targets.mk
index 4435daa91..300fc8e0b 100644
--- a/mk/targets.mk
+++ b/mk/targets.mk
@@ -14,7 +14,14 @@ 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 echo $(firstword $(REMOTETAGS)) | cut -c 1-6)
+    TAGPREFIX  := $(subst refs/tags/,,$(lastword $(REMOTETAGS)))
+    GITVERSION ?= $(subst ^{},-n/a-g$(COMMIT),$(TAGPREFIX))
+  else
+    GITVERSION ?= $(shell git describe --match release\* --abbrev=6 HEAD)
+  endif
   GITSTATUS  ?= $(shell git status -uno --porcelain)
 else
  -include mk/version.mk
-- 
2.39.0


[-- Attachment #3: Type: text/plain, Size: 218 bytes --]


Emacs  : GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ 
Version 3.24.36, cairo version 1.17.6)
 of 2023-01-08
Package: Org mode version 9.6.1 (release_9.6.1-137-gecb62e @ 
/home/n/.emacs.d/elpaca/builds/org/)

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-02-10 13:22 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-15 20:01 [PATCH] Support building Org from shallow clone [9.6.1 (release_9.6.1-137-gecb62e @ /home/n/.emacs.d/elpaca/builds/org/)] No Wayman
2023-01-15 20:55 ` No Wayman
2023-01-16 13:38 ` Ihor Radchenko
2023-01-16 19:11   ` No Wayman
2023-01-17 10:38     ` Ihor Radchenko
2023-01-18 23:11       ` No Wayman
2023-01-18 23:12         ` No Wayman
2023-01-19 11:19           ` Ihor Radchenko
2023-01-20  1:38             ` No Wayman
2023-01-20 12:44               ` Ihor Radchenko
2023-01-20 14:50                 ` Max Nikulin
2023-02-10 13:21                   ` Ihor Radchenko
2023-01-20 17:34                 ` No Wayman
2023-01-21  9:36                   ` Ihor Radchenko

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.