Skip to content

Commit

Permalink
go/vcs: report correct directory for 'no version control'
Browse files Browse the repository at this point in the history
Apply golang/go@b99fdb2.

Updates golang/go#6175.
Helps golang/go#11490.

Change-Id: I897bac1bac94b53e950cb5cf5e572d25a7c5996b
Reviewed-on: https://go-review.googlesource.com/21342
Reviewed-by: Andrew Gerrand <[email protected]>
  • Loading branch information
dmitshur authored and adg committed Apr 8, 2016
1 parent b75b3f5 commit 13c24a6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion go/vcs/vcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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
Expand Down

0 comments on commit 13c24a6

Please sign in to comment.