Skip to content

Commit

Permalink
Remove .git directory from copied deploy source to avoid the git ops
Browse files Browse the repository at this point in the history
Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
  • Loading branch information
Warashi committed Dec 12, 2024
1 parent 951826e commit d0c77ee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/app/piped/deploysource/deploysource.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,13 @@ func (p *provider) copy(lw io.Writer) (*DeploySource, error) {
return nil, err
}

// To avoid the git operation on copied source.
// TODO: do not copy the .git directory to improve the performance.
if err := os.RemoveAll(filepath.Join(dest, ".git")); err != nil {
fmt.Fprintf(lw, "Unable to remove the .git directory from the copied deploy source (%v)\n", err)
return nil, err
}

return &DeploySource{
RepoDir: dest,
AppDir: filepath.Join(dest, p.appGitPath.Path),
Expand Down
7 changes: 7 additions & 0 deletions pkg/app/pipedv1/deploysource/deploysource.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,13 @@ func (p *provider) copy(lw io.Writer) (*DeploySource, error) {
return nil, err
}

// To avoid the git operation on copied source.
// TODO: do not copy the .git directory to improve the performance.
if err := os.RemoveAll(filepath.Join(dest, ".git")); err != nil {
fmt.Fprintf(lw, "Unable to remove the .git directory from the copied deploy source (%v)\n", err)
return nil, err
}

return &DeploySource{
RepoDir: dest,
AppDir: filepath.Join(dest, p.appGitPath.Path),
Expand Down

0 comments on commit d0c77ee

Please sign in to comment.