Skip to content

Commit

Permalink
[supervisor] Don't link the .git dotfile directory
Browse files Browse the repository at this point in the history
  • Loading branch information
csweichel committed Jan 3, 2022
1 parent 2ee4e7d commit 192d822
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 7 additions & 5 deletions components/dashboard/src/settings/Preferences.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ export default function Preferences() {
const additionalData = user?.additionalData || {};
additionalData.dotfileRepo = value;
await getGitpodService().server.updateLoggedInUser({ additionalData });
setDotfileRepo(value);
};

return <div>
Expand Down Expand Up @@ -162,10 +161,13 @@ export default function Preferences() {
</SelectableCard>
</div>
<h3 className="mt-12">Dotfiles <PillLabel type="warn" className="font-semibold mt-2 py-0.5 px-2 self-center">Beta</PillLabel></h3>
<p className="text-base text-gray-500 dark:text-gray-400">Customise every workspace using dotfiles. Add a repo below which gets cloned and installed during workspace startup.</p>
<div className="mt-4">
<h4>Repo</h4>
<input type="text" value={dotfileRepo} onChange={(e) => actuallySetDotfileRepo(e.target.value)} className="w-full" />
<p className="text-base text-gray-500 dark:text-gray-400">Customize workspaces using dotfiles.</p>
<div className="mt-4 max-w-md">
<h4>Repository URL</h4>
<input type="text" value={dotfileRepo} className="w-full" placeholder="e.g. https://github.com/username/dotfiles" onChange={(e) => setDotfileRepo(e.target.value)} />
<button onClick={() => actuallySetDotfileRepo(dotfileRepo)}>
Save Changes
</button>
</div>
</PageWithSubMenu>
</div>;
Expand Down
5 changes: 5 additions & 0 deletions components/supervisor/pkg/supervisor/supervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 192d822

Please sign in to comment.