summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/makefile6
-rwxr-xr-xcrawl-ref/source/util/gen_ver.pl9
2 files changed, 12 insertions, 3 deletions
diff --git a/crawl-ref/source/makefile b/crawl-ref/source/makefile
index 1b36d16eb4..da620bbf7c 100644
--- a/crawl-ref/source/makefile
+++ b/crawl-ref/source/makefile
@@ -142,6 +142,10 @@ ifdef NEED_STATIC
LDFLAGS += -static
endif
+ifdef USE_MERGE_BASE
+MERGE_BASE := $(shell git merge-base HEAD $(USE_MERGE_BASE))
+endif
+
# Permissions to set on the game executable.
MCHMOD := 2755
@@ -605,7 +609,7 @@ compflag.h:
$(QUIET_GEN)util/gen-cflg.pl compflag.h "$(CFLAGS)" "$(CFLAGS_L)" "$(LDFLAGS)"
build.h:
- $(QUIET_GEN)util/gen_ver.pl $@
+ $(QUIET_GEN)util/gen_ver.pl $@ $(MERGE_BASE)
version.cc: build.h compflag.h
diff --git a/crawl-ref/source/util/gen_ver.pl b/crawl-ref/source/util/gen_ver.pl
index a82486380f..4902be79a9 100755
--- a/crawl-ref/source/util/gen_ver.pl
+++ b/crawl-ref/source/util/gen_ver.pl
@@ -11,6 +11,11 @@ my $cwd = cwd;
my $in_git = 1;
my $scriptpath = dirname($0);
my $outfile = $ARGV[0];
+my $mergebase = $ARGV[1];
+
+if (!$mergebase) {
+ $mergebase = "";
+}
my $releasever;
@@ -22,7 +27,7 @@ mkdir dirname($outfile);
my $verstring = "";
-$verstring = `git describe --tags --long 2> /dev/null || git describe --tags 2> /dev/null`;
+$verstring = `git describe --tags --long $mergebase 2> /dev/null || git describe --tags $mergebase 2> /dev/null`;
if (!$verstring) {
print STDERR "WARNING: Couldn't get revision information from Git. Using $scriptpath/release_ver.\n";
@@ -80,7 +85,7 @@ if ( !$build ) {
# Old versions of git omit the commits-since-tag number,
# so we can try 'git rev-list' to get this instead.
if ( $commit == 0 && $in_git ) {
- $commit = `git rev-list $tag.. | wc -l`
+ $commit = `git rev-list $tag..$mergebase | wc -l`
}
if ( $commit == 0 ) {