From aa4a019a1c4433a849aa07420fd2f94b40e5626e Mon Sep 17 00:00:00 2001 From: Matthieu Moy Date: Sun, 10 May 2015 16:11:33 +0200 Subject: [PATCH] Fix version string The previous version was hardcoded in the script, and not linked to Git tags. It has been 1.0 since Dec 24 15:35:32 2012, before the 1.0.0 tag actually. --- Makefile | 5 ++++- git-latexdiff | 12 ++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 68d1c01..494415a 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ ifndef SHELL_PATH endif SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) +GIT_LATEXDIFF_VERSION=${shell git describe --tags HEAD} gitexecdir_SQ = $(subst ','\'',$(gitexecdir)) SCRIPT=git-latexdiff @@ -19,5 +20,7 @@ help: @echo 'Run "$(MAKE) install" to install $(SCRIPT) in gitexecdir.' install: - sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' $(SCRIPT) > '$(gitexecdir_SQ)/$(SCRIPT)' + sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ + -e 's|@GIT_LATEXDIFF_VERSION@|$(GIT_LATEXDIFF_VERSION)|' \ + $(SCRIPT) > '$(gitexecdir_SQ)/$(SCRIPT)' chmod 755 '$(gitexecdir)/$(SCRIPT)' diff --git a/git-latexdiff b/git-latexdiff index 489fe34..2c1eded 100755 --- a/git-latexdiff +++ b/git-latexdiff @@ -41,7 +41,15 @@ set -o errexit set -o noclobber -git_latexdiff_version=1.0 +git_latexdiff_version='@GIT_LATEXDIFF_VERSION@' + +git_latexdiff_compute_version () { + if [ "$git_latexdiff_version" = '@GIT_LATEXDIFF_VERSION@' ]; then + (cd "$(dirname "$0")" && git describe --tags HEAD) + else + echo "$git_latexdiff_version" + fi +} usage () { cat << EOF @@ -223,7 +231,7 @@ while test $# -ne 0; do quiet=1 ;; "--version") - echo "$git_latexdiff_version" + git_latexdiff_compute_version exit 0 ;; "--subtree")