diff options
author | Mike Andrews <mra@xoba.com> | 2014-04-03 16:31:41 -0700 |
---|---|---|
committer | Mike Andrews <mra@xoba.com> | 2014-04-03 16:31:41 -0700 |
commit | f83f83f1f355de555848c267960428fd36caa5e5 (patch) | |
tree | 8a5f36e8c4fc73724b7f3442ad1eadc74270ee18 /src/cmd/dist | |
parent | 4450e3ddc3bafc24648a3834786a84a8bff767fb (diff) | |
download | go-f83f83f1f355de555848c267960428fd36caa5e5.tar.gz |
cmd/dist: reflect local changes to tree in goversion
runtime.Version() requires a trailing "+" when
tree had local modifications at time of build.
Fixes issue 7701
LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://codereview.appspot.com/84040045
Committer: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/cmd/dist')
-rw-r--r-- | src/cmd/dist/build.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/cmd/dist/build.c b/src/cmd/dist/build.c index d898a31b9..be05b82f1 100644 --- a/src/cmd/dist/build.c +++ b/src/cmd/dist/build.c @@ -242,12 +242,13 @@ findgoversion(void) { char *tag, *rev, *p; int i, nrev; - Buf b, path, bmore, branch; + Buf b, path, bmore, bplus, branch; Vec tags; binit(&b); binit(&path); binit(&bmore); + binit(&bplus); binit(&branch); vinit(&tags); @@ -314,11 +315,16 @@ findgoversion(void) // Add extra information. run(&bmore, goroot, CheckExit, "hg", "log", "--template", " +{node|short} {date|date}", "-r", rev, nil); chomp(&bmore); + // Generate a list of local modifications, if any. + run(&bplus, goroot, CheckExit, "hg", "status", "-m", "-a", "-r", "-d", nil); + chomp(&bplus); } bprintf(&b, "%s", tag); if(bmore.len > 0) bwriteb(&b, &bmore); + if(bplus.len > 0) + bwritestr(&b, " +"); // Cache version. writefile(&b, bstr(&path), 0); @@ -330,6 +336,7 @@ done: bfree(&b); bfree(&path); bfree(&bmore); + bfree(&bplus); bfree(&branch); vfree(&tags); |