Newer git version (2.11.0) default to 9 characters for the abbreviated
authorWard Vandewege <ward@curoverse.com>
Sun, 24 Sep 2017 18:39:41 +0000 (14:39 -0400)
committerWard Vandewege <ward@curoverse.com>
Sun, 24 Sep 2017 18:42:31 +0000 (14:42 -0400)
git hash. Explicitly select a minimum of 9 in the code, and adjust tests
to have 9 characters for the return value that is checked.

No issue #

Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <wvandewege@veritasgenetics.com>

arvados-version-server/arvados-version-server.go
arvados-version-server/arvados-version-server_test.go

index 2f40df034f71f2f342bd6854ddd3f253e7e8be23..f377979034e34f07bbb8e1dc1794370100ad98ea 100644 (file)
@@ -423,7 +423,7 @@ func versionFromGit(prefix string) (string, error) {
        if err != nil {
                return "", err
        }
-       cmdArgs := []string{"log", "-n1", "--first-parent", "--max-count=1", "--format=format:%h", "."}
+       cmdArgs := []string{"log", "-n1", "--first-parent", "--max-count=1", "--format=format:%h", "--abbrev=9", "."}
        gitHash, err := exec.Command(theConfig.GitExecutablePath, cmdArgs...).Output()
        if err != nil {
                logError([]string{"There was an error running the command ", theConfig.GitExecutablePath, strings.Join(cmdArgs, " "), err.Error()})
index 347ab181f9ac80a1ac9694a3d19dc0e0a0654c55..874c4b35c61df1a8ca13263b8293f207896484a9 100644 (file)
@@ -171,7 +171,7 @@ func (s *ServerRequiredSuite) TestResults(c *C) {
                c.Check(err, Equals, nil)
                c.Check(resp.StatusCode, Equals, 200)
                body, err := ioutil.ReadAll(resp.Body)
-               c.Check(string(body), Matches, ".*\"arvados-src\":\"0.1.20130104011935.155848c\".*")
+               c.Check(string(body), Matches, ".*\"arvados-src\":\"0.1.20130104011935.155848c15\".*")
        }
 
        // Check the arvados-src version string for a more recent commit
@@ -184,7 +184,7 @@ func (s *ServerRequiredSuite) TestResults(c *C) {
                c.Check(err, Equals, nil)
                c.Check(resp.StatusCode, Equals, 200)
                body, err := ioutil.ReadAll(resp.Body)
-               c.Check(string(body), Matches, ".*\"arvados-src\":\"0.1.20161208152419.9c1a287\".*")
+               c.Check(string(body), Matches, ".*\"arvados-src\":\"0.1.20161208152419.9c1a28719\".*")
        }
 
        // Check the arvados-src version string for a weirdly truncated commit
@@ -197,7 +197,7 @@ func (s *ServerRequiredSuite) TestResults(c *C) {
                c.Check(err, Equals, nil)
                c.Check(resp.StatusCode, Equals, 200)
                body, err := ioutil.ReadAll(resp.Body)
-               c.Check(string(body), Matches, ".*\"arvados-src\":\"0.1.20161208152419.9c1a287\".*")
+               c.Check(string(body), Matches, ".*\"arvados-src\":\"0.1.20161208152419.9c1a28719\".*")
        }
 
        // Check an invalid request hash