From 571633105560b1f5922b1e7a0db9140d9cdadfcf Mon Sep 17 00:00:00 2001 From: JenTing Hsiao Date: Fri, 26 Aug 2022 05:07:03 +0000 Subject: [PATCH] Chown all files and folders after git checkout Signed-off-by: JenTing Hsiao --- components/content-service/pkg/initializer/git.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/components/content-service/pkg/initializer/git.go b/components/content-service/pkg/initializer/git.go index 3f0f1916aace5a..2eade19f4cb469 100644 --- a/components/content-service/pkg/initializer/git.go +++ b/components/content-service/pkg/initializer/git.go @@ -110,7 +110,11 @@ func (ws *GitInitializer) Run(ctx context.Context, mappings []archive.IDMapping) return src, xerrors.Errorf("git initializer gitClone: %w", err) } - if ws.Chown { + defer func() { + span.SetTag("Chown", ws.Chown) + if !ws.Chown { + return + } // TODO (aledbf): refactor to remove the need of manual chown args := []string{"-R", "-L", "gitpod", ws.Location} cmd := exec.Command("chown", args...) @@ -124,7 +128,8 @@ func (ws *GitInitializer) Run(ctx context.Context, mappings []archive.IDMapping) } return } - } + }() + if err := ws.realizeCloneTarget(ctx); err != nil { return src, xerrors.Errorf("git initializer clone: %w", err) }