From 43096bb1f31efe169285b1d39a311af2c455c98f Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Mon, 4 Sep 2023 15:13:03 +0300 Subject: [PATCH 1/4] fix(cli/dotfiles): Only ignore .git directory Resolves #8306 --- cli/dotfiles.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/dotfiles.go b/cli/dotfiles.go index 635a3add33c0a..399401fa77efb 100644 --- a/cli/dotfiles.go +++ b/cli/dotfiles.go @@ -176,8 +176,8 @@ func (r *RootCmd) dotfiles() *clibase.Cmd { var dotfiles []string for _, f := range files { - // make sure we do not copy `.git*` files - if strings.HasPrefix(f.Name(), ".") && !strings.HasPrefix(f.Name(), ".git") { + // make sure we do not copy `.git` directory + if strings.HasPrefix(f.Name(), ".") && f.Name() != ".git" { { dotfiles = append(dotfiles, f.Name()) } } From 08c875cb55ecec872a3a0fa7deddd6afd4cc000d Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Mon, 4 Sep 2023 15:15:50 +0300 Subject: [PATCH 2/4] fix fmt --- cli/dotfiles.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/dotfiles.go b/cli/dotfiles.go index 399401fa77efb..980756d1421dd 100644 --- a/cli/dotfiles.go +++ b/cli/dotfiles.go @@ -177,7 +177,7 @@ func (r *RootCmd) dotfiles() *clibase.Cmd { var dotfiles []string for _, f := range files { // make sure we do not copy `.git` directory - if strings.HasPrefix(f.Name(), ".") && f.Name() != ".git" { { + if strings.HasPrefix(f.Name(), ".") && f.Name() != ".git" { dotfiles = append(dotfiles, f.Name()) } } From 35de9b1de719f743670f1005ba887e873017fb0d Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Mon, 4 Sep 2023 16:03:46 +0300 Subject: [PATCH 3/4] add exception for .gitconfig --- cli/dotfiles.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/dotfiles.go b/cli/dotfiles.go index 980756d1421dd..ca3ebf638abcb 100644 --- a/cli/dotfiles.go +++ b/cli/dotfiles.go @@ -176,8 +176,8 @@ func (r *RootCmd) dotfiles() *clibase.Cmd { var dotfiles []string for _, f := range files { - // make sure we do not copy `.git` directory - if strings.HasPrefix(f.Name(), ".") && f.Name() != ".git" { + // make sure we do not copy `.git*` files except .gitconfig + if strings.HasPrefix(f.Name(), ".") && (!strings.HasPrefix(f.Name(), ".git") || f.Name() == ".gitconfig") { dotfiles = append(dotfiles, f.Name()) } } From 23dce9366042b2afa02b13d19ca852abfaf93891 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Mon, 4 Sep 2023 16:04:16 +0300 Subject: [PATCH 4/4] Update dotfiles.go --- cli/dotfiles.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/dotfiles.go b/cli/dotfiles.go index ca3ebf638abcb..88d57c7089eaf 100644 --- a/cli/dotfiles.go +++ b/cli/dotfiles.go @@ -176,7 +176,7 @@ func (r *RootCmd) dotfiles() *clibase.Cmd { var dotfiles []string for _, f := range files { - // make sure we do not copy `.git*` files except .gitconfig + // make sure we do not copy `.git*` files except `.gitconfig` if strings.HasPrefix(f.Name(), ".") && (!strings.HasPrefix(f.Name(), ".git") || f.Name() == ".gitconfig") { dotfiles = append(dotfiles, f.Name()) }