// FindVcs determines the version control information given a package dir and
// lowest root dir.

FindVcs determines the version control information given a package dir and
lowest root dir.
// FindVcs determines the version control information given a package dir and // lowest root dir .
func FindVcs(root, packageDir string) (info *VcsInfo, err error) {
	if !filepath.IsAbs(root) {
		return nil, nil
	}
	if !filepath.IsAbs(packageDir) {
		return nil, nil
	}
	path := packageDir
	for i := 0; i <= looplimit; i++ {
		for _, vcs := range vcsRegistry {
			info, err = vcs.Find(path)
			if err != nil {
				return nil, err
			}
			if info != nil {
				return info, nil
			}
		}
		nextPath := filepath.Clean(filepath.Join(path, ".."))
		if nextPath == path {
			return nil, nil
		}
		if pathos.FileHasPrefix(nextPath, root) == false {
			return nil, nil
		}
		path = nextPath
	}
	panic("loop limit")
}
func FindVcs ( root , packageDir string ) ( info * VcsInfo , err error ) { if ! filepath . IsAbs ( root ) { return nil , nil } if ! filepath . IsAbs ( packageDir ) { return nil , nil } path := packageDir for i := 0 ; i <= looplimit ; i ++ { for _ , vcs := range vcsRegistry { info , err = vcs . Find ( path ) if err != nil { return nil , err } if info != nil { return info , nil } } nextPath := filepath . Clean ( filepath . Join ( path , " " ) ) if nextPath == path { return nil , nil } if pathos . FileHasPrefix ( nextPath , root ) == false { return nil , nil } path = nextPath } panic ( " " ) }
FindVcs determines the version control information given a package dir and
lowest root dir.
FindVcs determines the version control information given a package dir and lowest root dir .
// Check for root.
