提交 e45e153a 作者: Brian Tiger Chow

rename to repo path

fix FIXUP repo -> config
上级 eeec8ab3
...@@ -220,15 +220,15 @@ func (i *cmdInvocation) Parse(ctx context.Context, args []string) error { ...@@ -220,15 +220,15 @@ func (i *cmdInvocation) Parse(ctx context.Context, args []string) error {
return err return err
} }
configPath, err := getConfigRoot(i.req) repoPath, err := getRepoPath(i.req)
if err != nil { if err != nil {
return err return err
} }
log.Debugf("config path is %s", configPath) log.Debugf("config path is %s", repoPath)
// this sets up the function that will initialize the config lazily. // this sets up the function that will initialize the config lazily.
cmdctx := i.req.Context() cmdctx := i.req.Context()
cmdctx.ConfigRoot = configPath cmdctx.ConfigRoot = repoPath
cmdctx.LoadConfig = loadConfig cmdctx.LoadConfig = loadConfig
// this sets up the function that will initialize the node // this sets up the function that will initialize the node
// this is so that we can construct the node lazily. // this is so that we can construct the node lazily.
...@@ -415,20 +415,20 @@ func isClientError(err error) bool { ...@@ -415,20 +415,20 @@ func isClientError(err error) bool {
return false return false
} }
func getConfigRoot(req cmds.Request) (string, error) { func getRepoPath(req cmds.Request) (string, error) {
configOpt, found, err := req.Option("config").String() repoOpt, found, err := req.Option("config").String()
if err != nil { if err != nil {
return "", err return "", err
} }
if found && configOpt != "" { if found && repoOpt != "" {
return configOpt, nil return repoOpt, nil
} }
configPath, err := config.PathRoot() repoPath, err := fsrepo.BestKnownPath()
if err != nil { if err != nil {
return "", err return "", err
} }
return configPath, nil return repoPath, nil
} }
func loadConfig(path string) (*config.Config, error) { func loadConfig(path string) (*config.Config, error) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论