Re: Add git-version-script.

3 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: Add git-version-script.

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:05

Martin Atukunda [off-list ref] writes:
This script simply reports the version of git you have installed.
I wanted to ahve some way of recording the git version, but I am
wondering if 'git' without parameter telling the version number
would be good enough without introducing yet another script.

Re: Add git-version-script.

From: A Large Angry SCM <hidden>
Date: 2016-06-15 22:42:05

Junio C Hamano wrote:
Martin Atukunda [off-list ref] writes:
quoted
This script simply reports the version of git you have installed.
I wanted to ahve some way of recording the git version, but I am
wondering if 'git' without parameter telling the version number
would be good enough without introducing yet another script.
git --version

[PATCH] Re: Add git-version-script.

From: Martin Atukunda <hidden>
Date: 2016-06-15 22:42:05

Add version string to git.

Signed-off-by: Martin Atukunda <redacted>

---

 Makefile |    3 ++-
 git.in   |   25 +++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletions(-)
 create mode 100755 git.in

6a9edfa27c41b7845bfd519e275c24d7e36ad702
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -218,7 +218,8 @@ $(LIB_FILE): $(LIB_OBJS)
 doc:
 	$(MAKE) -C Documentation all
 
-
+git: git.in Makefile
+	sed 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@
 
 ### Testing rules
 
diff --git a/git.in b/git.in
new file mode 100755
--- /dev/null
+++ b/git.in
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+cmd=
+path=$(dirname $0)
+case "$#" in
+0)	;;
+*)	cmd="$1"
+	shift
+	if [ "$cmd" == "--version" ]; then
+		echo "git version @@VERSION@@"
+		exit 0
+	fi
+	test -x $path/git-$cmd-script && exec $path/git-$cmd-script "$@"
+	test -x $path/git-$cmd && exec $path/git-$cmd "$@" ;;
+esac
+
+echo "git version @@VERSION@@"
+echo "Usage: git COMMAND [OPTIONS] [TARGET]"
+if [ -n "$cmd" ]; then
+    echo " git command '$cmd' not found: commands are:"
+else
+    echo " git commands are:"
+fi
+
+ls $path | sed -ne 's/^git-\(.*\)-script/  \1/p' | fmt

-- 
Your entire blood supply is filtered through your kidneys in four minutes.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help