mirror of
https://github.com/x-motemen/ghq.git
synced 2026-09-10 07:26:27 -04:00
Merge abe77b676d into 2474201bcc
This commit is contained in:
commit
40d11cb842
10
cmd_get.go
10
cmd_get.go
|
|
@ -13,6 +13,7 @@ import (
|
|||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/Songmu/gitconfig"
|
||||
"github.com/mattn/go-isatty"
|
||||
"github.com/urfave/cli/v3"
|
||||
"github.com/x-motemen/ghq/cmdutil"
|
||||
|
|
@ -27,6 +28,15 @@ func doGet(ctx context.Context, cmd *cli.Command) error {
|
|||
parallel = cmd.Bool("parallel")
|
||||
silent = cmd.Bool("silent")
|
||||
)
|
||||
if !andLook {
|
||||
v, err := gitconfig.Bool("ghq.look")
|
||||
if err != nil && !gitconfig.IsNotFound(err) {
|
||||
return err
|
||||
}
|
||||
if err == nil {
|
||||
andLook = v
|
||||
}
|
||||
}
|
||||
g := &getter{
|
||||
update: cmd.Bool("update"),
|
||||
shallow: cmd.Bool("shallow"),
|
||||
|
|
|
|||
|
|
@ -497,6 +497,31 @@ func TestBareLook(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestLookFromGitConfig(t *testing.T) {
|
||||
withFakeGitBackend(t, func(t *testing.T, tmproot string, _ *_cloneArgs, _ *_updateArgs) {
|
||||
os.MkdirAll(filepath.Join(tmproot, "github.com", "motemen", "ghq", ".git"), 0755)
|
||||
defer func(orig func(cmd *exec.Cmd) error) {
|
||||
cmdutil.CommandRunner = orig
|
||||
}(cmdutil.CommandRunner)
|
||||
var lastCmd *exec.Cmd
|
||||
cmdutil.CommandRunner = func(cmd *exec.Cmd) error {
|
||||
lastCmd = cmd
|
||||
return nil
|
||||
}
|
||||
|
||||
t.Cleanup(gitconfig.WithConfig(t, `[ghq]
|
||||
look = true
|
||||
`))
|
||||
err := newApp().Run([]string{"", "get", "https://github.com/motemen/ghq"})
|
||||
if err != nil {
|
||||
t.Errorf("error should be nil, but: %s", err)
|
||||
}
|
||||
if lastCmd == nil {
|
||||
t.Fatal("shell should have been launched")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestDoGet_bulk(t *testing.T) {
|
||||
in := []string{
|
||||
"github.com/x-motemen/ghq",
|
||||
|
|
|
|||
Loading…
Reference in a new issue