go/vcs: report correct directory for 'no version control'
Apply golang/go@b99fdb2a11. Updates golang/go#6175. Helps golang/go#11490. Change-Id: I897bac1bac94b53e950cb5cf5e572d25a7c5996b Reviewed-on: https://go-review.googlesource.com/21342 Reviewed-by: Andrew Gerrand <adg@golang.org>
This commit is contained in:
parent
b75b3f5cd5
commit
13c24a6d6a
|
@ -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)
|
return nil, "", fmt.Errorf("directory %q is outside source root %q", dir, srcRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
origDir := dir
|
||||||
for len(dir) > len(srcRoot) {
|
for len(dir) > len(srcRoot) {
|
||||||
for _, vcs := range vcsList {
|
for _, vcs := range vcsList {
|
||||||
if fi, err := os.Stat(filepath.Join(dir, "."+vcs.Cmd)); err == nil && fi.IsDir() {
|
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
|
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
|
// RepoRoot represents a version control system, a repo, and a root of
|
||||||
|
|
Loading…
Reference in New Issue