From: No Wayman <iarchivedmywholelife@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Support building Org from shallow clone [9.6.1 (release_9.6.1-137-gecb62e @ /home/n/.emacs.d/elpaca/builds/org/)]
Date: Mon, 16 Jan 2023 14:11:28 -0500 [thread overview]
Message-ID: <87tu0q5m2t.fsf@gmail.com> (raw)
In-Reply-To: <87358alhux.fsf@localhost>
[-- Attachment #1: Type: text/plain, Size: 263 bytes --]
Ihor Radchenko <yantar92@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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: revised-to-handle-upstream-unavailable --]
[-- Type: text/x-patch, Size: 1549 bytes --]
From 4ce8b2dfc2cf2ca1507aa14be15f5212eb1de229 Mon Sep 17 00:00:00 2001
From: Nicholas Vollmer <iarchivedmywholelife@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 | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/mk/targets.mk b/mk/targets.mk
index 4435daa9..9a62cbd4 100644
--- a/mk/targets.mk
+++ b/mk/targets.mk
@@ -14,7 +14,15 @@ 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)
+ TAGPREFIX := $(subst refs/tags/,,$(lastword $(REMOTETAGS)))
+ GITVERSION ?= $(subst ^{},-n/a-g$(COMMIT),$(TAGPREFIX))
+ 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
next prev parent reply other threads:[~2023-01-16 19:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tu0q5m2t.fsf@gmail.com \
--to=iarchivedmywholelife@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=yantar92@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).