aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2015-11-01 17:08:38 -0500
committerJustin M. Keyes <justinkz@gmail.com>2015-11-01 21:31:29 -0500
commitd0401b04a4ed6a1684091a84bfd262b2b2cb560f (patch)
tree758526fcc63bc9fa1970c5de80155c0c95077064 /src
parentc4826c300340a9e4df20964a14650caf64fc1b58 (diff)
downloadrneovim-d0401b04a4ed6a1684091a84bfd262b2b2cb560f.tar.gz
rneovim-d0401b04a4ed6a1684091a84bfd262b2b2cb560f.tar.bz2
rneovim-d0401b04a4ed6a1684091a84bfd262b2b2cb560f.zip
build: Use `git describe` for version strings.
When building in a git repo: - If HEAD corresponds to an annotated tag, (i.e. git_get_exact_tag() returns truthy) the current build is considered a "release" build: NVIM_VERSION_MEDIUM is directly assigned the tagged version name, and NVIM_VERSION_* defines are ignored. - If HEAD is not a tagged release, then NVIM_VERSION_MEDIUM is directly assigned the result of `git describe`. If git (or the repo) is not available: - The NVIM_VERSION_* defines are used to define NVIM_VERSION_MEDIUM. Sample outputs for `nvim --version` and `nvim +version`: Building with git @ non-tagged commit e66df14: NVIM v0.1.0-1-ge66df14 (compiled Nov 1 2015 19:10:30) Commit: e66df148f9401be17adab324a6e41d927aae20b3 Building with git @ v0.1.1 tag: NVIM v0.1.1 (compiled Nov 1 2015 19:03:52) [no "Commit:" line] Building this commit _not_ in a git repo: NVIM 0.1.0-dev (compiled Nov 1 2015 19:16:11) [no "Commit:" line]
Diffstat (limited to 'src')
-rw-r--r--src/nvim/version.c15
-rw-r--r--src/nvim/version.h1
2 files changed, 8 insertions, 8 deletions
diff --git a/src/nvim/version.c b/src/nvim/version.c
index c8cbcf2439..5a0f7d524d 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -25,17 +25,18 @@
#define STR_(x) #x
#define STR(x) STR_(x)
-// for the startup-screen ( ":intro" command )
-#define NVIM_VERSION_MEDIUM STR(NVIM_VERSION_MAJOR) "." STR(NVIM_VERSION_MINOR)
-
-// for the ":version" command and "nvim --version"
-#define NVIM_VERSION_LONG "NVIM " NVIM_VERSION_MEDIUM "." STR(NVIM_VERSION_PATCH) NVIM_VERSION_PRERELEASE NVIM_VERSION_BUILD
+// for ":version", ":intro", and "nvim --version"
+#ifndef NVIM_VERSION_MEDIUM
+#define NVIM_VERSION_MEDIUM STR(NVIM_VERSION_MAJOR) "." STR(NVIM_VERSION_MINOR)\
+ "." STR(NVIM_VERSION_PATCH) NVIM_VERSION_PRERELEASE
+#endif
+#define NVIM_VERSION_LONG "NVIM " NVIM_VERSION_MEDIUM
char *Version = VIM_VERSION_SHORT;
char *longVersion = NVIM_VERSION_LONG;
-char *longVersionWithDate = NVIM_VERSION_LONG " (compiled " __DATE__ " " __TIME__ ")";
-char *mediumVersion = NVIM_VERSION_MEDIUM;
+char *longVersionWithDate = NVIM_VERSION_LONG \
+ " (compiled " __DATE__ " " __TIME__ ")";
#ifdef NVIM_VERSION_COMMIT
char *version_commit = "Commit: " NVIM_VERSION_COMMIT;
#endif
diff --git a/src/nvim/version.h b/src/nvim/version.h
index c1881250f1..1de809e539 100644
--- a/src/nvim/version.h
+++ b/src/nvim/version.h
@@ -3,7 +3,6 @@
// defined in version.c
extern char* Version;
-extern char* mediumVersion;
extern char* longVersion;
//