From 13c24a6d6a329878e5ee2cdb76d84423604191d5 Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Wed, 30 Mar 2016 22:21:51 -0700 Subject: [PATCH] go/vcs: report correct directory for 'no version control' Apply golang/go@b99fdb2a11ae58834a2c0c646f54d0a587dd269c. Updates golang/go#6175. Helps golang/go#11490. Change-Id: I897bac1bac94b53e950cb5cf5e572d25a7c5996b Reviewed-on: https://go-review.googlesource.com/21342 Reviewed-by: Andrew Gerrand --- go/vcs/vcs.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/go/vcs/vcs.go b/go/vcs/vcs.go index f0aed571..45bd814f 100644 --- a/go/vcs/vcs.go +++ b/go/vcs/vcs.go @@ -344,6 +344,7 @@ func FromDir(dir, srcRoot string) (vcs *Cmd, root string, err error) { return nil, "", fmt.Errorf("directory %q is outside source root %q", dir, srcRoot) } + origDir := dir for len(dir) > len(srcRoot) { for _, vcs := range vcsList { if fi, err := os.Stat(filepath.Join(dir, "."+vcs.Cmd)); err == nil && fi.IsDir() { @@ -360,7 +361,7 @@ func FromDir(dir, srcRoot string) (vcs *Cmd, root string, err error) { dir = ndir } - return nil, "", fmt.Errorf("directory %q is not using a known version control system", dir) + return nil, "", fmt.Errorf("directory %q is not using a known version control system", origDir) } // RepoRoot represents a version control system, a repo, and a root of