Merge pull request #400 from Masterminds/feat/vcs-1.6.1

Updating to VCS 1.6.1
diff --git a/glide.lock b/glide.lock
index eeae594..7557f3e 100644
--- a/glide.lock
+++ b/glide.lock
@@ -1,12 +1,12 @@
-hash: 3a5b11283c409c77e79505c08a39550a966d62fb0896f4355c10d699482840a3
-updated: 2016-04-18T09:49:03.335458835-04:00
+hash: 78e2fef6acf410a5c01231739017e3b0fe7762e815bf1a9b1e577ed5af1d5693
+updated: 2016-04-27T11:53:07.688047146-04:00
 imports:
 - name: github.com/codegangsta/cli
   version: 71f57d300dd6a780ac1856c005c4b518cfd498ec
 - name: github.com/Masterminds/semver
   version: 808ed7761c233af2de3f9729a041d68c62527f3a
 - name: github.com/Masterminds/vcs
-  version: fa85cceafacd29c84a8aa6e68967bb9f1754e5e3
+  version: f6cc1e9e7389eea70d925c03eea2d6f8670f5109
 - name: gopkg.in/yaml.v2
   version: a83829b6f1293c91addabc89d0571c246397bbf4
 devImports: []
diff --git a/glide.yaml b/glide.yaml
index e9e3a02..1018832 100644
--- a/glide.yaml
+++ b/glide.yaml
@@ -11,7 +11,8 @@
 import:
 - package: gopkg.in/yaml.v2
 - package: github.com/Masterminds/vcs
-  version: ^1.6.0
+  version: ^1.6.1
 - package: github.com/codegangsta/cli
+  version: ^1.14.0
 - package: github.com/Masterminds/semver
   version: ^1.0.0
diff --git a/vendor/github.com/Masterminds/vcs/CHANGELOG.md b/vendor/github.com/Masterminds/vcs/CHANGELOG.md
index 7a04e56..a33839a 100644
--- a/vendor/github.com/Masterminds/vcs/CHANGELOG.md
+++ b/vendor/github.com/Masterminds/vcs/CHANGELOG.md
@@ -1,3 +1,9 @@
+# 1.6.1 (2016-04-27)
+
+- Fixed #30: tags from commit should not have ^{} appended (seen in git)
+- Fixed #29: isDetachedHead fails with non-english locales (git)
+- Fixed #33: Access denied and not found http errors causing xml parsing errors
+
 # 1.6.0 (2016-04-18)
 
 - Issue #26: Added Init method to initialize a repo at the local location
diff --git a/vendor/github.com/Masterminds/vcs/git.go b/vendor/github.com/Masterminds/vcs/git.go
index 5d4b956..26d50ee 100644
--- a/vendor/github.com/Masterminds/vcs/git.go
+++ b/vendor/github.com/Masterminds/vcs/git.go
@@ -1,7 +1,9 @@
 package vcs
 
 import (
+	"bytes"
 	"encoding/xml"
+	"io/ioutil"
 	"os"
 	"os/exec"
 	"path/filepath"
@@ -289,7 +291,8 @@
 	}
 	tags := s.referenceList(strings.Join(list, "\n"), `(?m-s)(?:tags)/(\S+)$`)
 	for _, t := range tags {
-		re = append(re, t)
+		// Dereferenced tags have ^{} appended to them.
+		re = append(re, strings.TrimSuffix(t, "^{}"))
 	}
 
 	return re, nil
@@ -313,16 +316,18 @@
 
 // isDetachedHead will detect if git repo is in "detached head" state.
 func isDetachedHead(dir string) (bool, error) {
-	c := exec.Command("git", "status", "-uno")
-	c.Dir = dir
-	c.Env = envForDir(c.Dir)
-	out, err := c.CombinedOutput()
+	p := filepath.Join(dir, ".git", "HEAD")
+	contents, err := ioutil.ReadFile(p)
 	if err != nil {
 		return false, err
 	}
-	detached := strings.Contains(string(out), "HEAD detached at")
 
-	return detached, nil
+	contents = bytes.TrimSpace(contents)
+	if bytes.HasPrefix(contents, []byte("ref: ")) {
+		return false, nil
+	}
+
+	return true, nil
 }
 
 // isUnableToCreateDir checks for an error in Init() to see if an error
diff --git a/vendor/github.com/Masterminds/vcs/vcs_remote_lookup.go b/vendor/github.com/Masterminds/vcs/vcs_remote_lookup.go
index 915931d..85fac7f 100644
--- a/vendor/github.com/Masterminds/vcs/vcs_remote_lookup.go
+++ b/vendor/github.com/Masterminds/vcs/vcs_remote_lookup.go
@@ -90,10 +90,6 @@
 		return t, vcsURL, nil
 	}
 
-	// Need to test for vanity or paths like golang.org/x/
-
-	// TODO: Test for 3xx redirect codes and handle appropriately.
-
 	// Pages like https://golang.org/x/net provide an html document with
 	// meta tags containing a location to work with. The go tool uses
 	// a meta tag with the name go-import which is what we use here.
@@ -117,10 +113,14 @@
 		return NoVCS, "", ErrCannotDetectVCS
 	}
 	defer resp.Body.Close()
+	if resp.StatusCode < 200 || resp.StatusCode >= 300 {
+		return NoVCS, "", ErrCannotDetectVCS
+	}
 
 	t, nu, err := parseImportFromBody(u, resp.Body)
 	if err != nil {
-		return NoVCS, "", err
+		// TODO(mattfarina): Log the parsing error
+		return NoVCS, "", ErrCannotDetectVCS
 	} else if t == "" || nu == "" {
 		return NoVCS, "", ErrCannotDetectVCS
 	}
@@ -299,6 +299,7 @@
 	}
 	defer resp.Body.Close()
 	if resp.StatusCode != 200 {
+		// TODO(mattfarina): log the failed status
 		return nil, fmt.Errorf("%s: %s", url, resp.Status)
 	}
 	b, err := ioutil.ReadAll(resp.Body)
diff --git a/vendor/github.com/Masterminds/vcs/vcs_remote_lookup_test.go b/vendor/github.com/Masterminds/vcs/vcs_remote_lookup_test.go
index 82decfc..fd7663e 100644
--- a/vendor/github.com/Masterminds/vcs/vcs_remote_lookup_test.go
+++ b/vendor/github.com/Masterminds/vcs/vcs_remote_lookup_test.go
@@ -13,6 +13,8 @@
 		"https://github.com/masterminds":                                   {work: false, t: Git},
 		"https://github.com/Masterminds/VCSTestRepo":                       {work: true, t: Git},
 		"https://bitbucket.org/mattfarina/testhgrepo":                      {work: true, t: Hg},
+		"https://bitbucket.org/mattfarina/repo-does-not-exist":             {work: false, t: Hg},
+		"https://bitbucket.org/mattfarina/private-repo-for-vcs-testing":    {work: false, t: Hg},
 		"https://launchpad.net/govcstestbzrrepo/trunk":                     {work: true, t: Bzr},
 		"https://launchpad.net/~mattfarina/+junk/mygovcstestbzrrepo":       {work: true, t: Bzr},
 		"https://launchpad.net/~mattfarina/+junk/mygovcstestbzrrepo/trunk": {work: true, t: Bzr},
@@ -56,6 +58,10 @@
 			t.Errorf("Error detecting VCS from URL(%s): %s", u, err)
 		}
 
+		if err != nil && err != ErrCannotDetectVCS && c.work == false {
+			t.Errorf("Unexpected error returned (%s): %s", u, err)
+		}
+
 		if c.work == true && ty != c.t {
 			t.Errorf("Incorrect VCS type returned(%s)", u)
 		}