From 192d82254d9d4b63f811ec297eab39dbfbf5bd36 Mon Sep 17 00:00:00 2001 From: Christian Weichel Date: Mon, 3 Jan 2022 11:13:40 +0000 Subject: [PATCH] [supervisor] Don't link the .git dotfile directory --- components/dashboard/src/settings/Preferences.tsx | 12 +++++++----- components/supervisor/pkg/supervisor/supervisor.go | 5 +++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/components/dashboard/src/settings/Preferences.tsx b/components/dashboard/src/settings/Preferences.tsx index 9ffa83ac23f136..efad8db1e4fb94 100644 --- a/components/dashboard/src/settings/Preferences.tsx +++ b/components/dashboard/src/settings/Preferences.tsx @@ -90,7 +90,6 @@ export default function Preferences() { const additionalData = user?.additionalData || {}; additionalData.dotfileRepo = value; await getGitpodService().server.updateLoggedInUser({ additionalData }); - setDotfileRepo(value); }; return
@@ -162,10 +161,13 @@ export default function Preferences() {

Dotfiles Beta

-

Customise every workspace using dotfiles. Add a repo below which gets cloned and installed during workspace startup.

-
-

Repo

- actuallySetDotfileRepo(e.target.value)} className="w-full" /> +

Customize workspaces using dotfiles.

+
+

Repository URL

+ setDotfileRepo(e.target.value)} /> +
; diff --git a/components/supervisor/pkg/supervisor/supervisor.go b/components/supervisor/pkg/supervisor/supervisor.go index 2be33a9dd95355..0e319166bc45ca 100644 --- a/components/supervisor/pkg/supervisor/supervisor.go +++ b/components/supervisor/pkg/supervisor/supervisor.go @@ -478,6 +478,11 @@ func installDotfiles(ctx context.Context, term *terminal.MuxTerminalService, cfg // no installation script candidate was found, let's try and symlink this stuff err = filepath.Walk(dotfilePath, func(path string, info fs.FileInfo, err error) error { + if strings.Contains(path, "/.git") { + // don't symlink the .git directory or any of its content + return nil + } + homeFN := filepath.Join("/home/gitpod", strings.TrimPrefix(path, dotfilePath)) if _, err := os.Stat(homeFN); err == nil { // homeFN exists already - do nothing