Commit 43b3e6e0 authored by Mike Andrews's avatar Mike Andrews Committed by Ian Lance Taylor

cmd/dist: reflect local changes to tree in goversion

runtime.Version() requires a trailing "+" when
tree had local modifications at time of build.

Fixes #7701

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/84040045
parent 17f9423e
...@@ -242,12 +242,13 @@ findgoversion(void) ...@@ -242,12 +242,13 @@ findgoversion(void)
{ {
char *tag, *rev, *p; char *tag, *rev, *p;
int i, nrev; int i, nrev;
Buf b, path, bmore, branch; Buf b, path, bmore, bplus, branch;
Vec tags; Vec tags;
binit(&b); binit(&b);
binit(&path); binit(&path);
binit(&bmore); binit(&bmore);
binit(&bplus);
binit(&branch); binit(&branch);
vinit(&tags); vinit(&tags);
...@@ -314,11 +315,16 @@ findgoversion(void) ...@@ -314,11 +315,16 @@ findgoversion(void)
// Add extra information. // Add extra information.
run(&bmore, goroot, CheckExit, "hg", "log", "--template", " +{node|short} {date|date}", "-r", rev, nil); run(&bmore, goroot, CheckExit, "hg", "log", "--template", " +{node|short} {date|date}", "-r", rev, nil);
chomp(&bmore); 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); bprintf(&b, "%s", tag);
if(bmore.len > 0) if(bmore.len > 0)
bwriteb(&b, &bmore); bwriteb(&b, &bmore);
if(bplus.len > 0)
bwritestr(&b, " +");
// Cache version. // Cache version.
writefile(&b, bstr(&path), 0); writefile(&b, bstr(&path), 0);
...@@ -330,6 +336,7 @@ done: ...@@ -330,6 +336,7 @@ done:
bfree(&b); bfree(&b);
bfree(&path); bfree(&path);
bfree(&bmore); bfree(&bmore);
bfree(&bplus);
bfree(&branch); bfree(&branch);
vfree(&tags); vfree(&tags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment