Skip to content

Commit 421836f

Browse files
authored
Merge pull request #114 from section/fix-split-apps-paths
fix split apps path handling
2 parents 5d5c9dd + f7b54b9 commit 421836f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

commands/gitService.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ import (
77
"log"
88
"os"
99
"path/filepath"
10+
"strings"
1011
"time"
12+
1113
"github.com/go-git/go-git/v5"
14+
"github.com/go-git/go-git/v5/plumbing"
15+
"github.com/go-git/go-git/v5/plumbing/object"
1216
gitHTTP "github.com/go-git/go-git/v5/plumbing/transport/http"
1317
"github.com/section/sectionctl/api"
14-
"github.com/go-git/go-git/v5/plumbing/object"
15-
"github.com/go-git/go-git/v5/plumbing"
1618
)
1719

1820
// GitService interface provides a way to interact with Git
@@ -32,8 +34,9 @@ func (g *GS) UpdateGitViaGit(c *DeployCmd, response UploadResponse) error {
3234
if err != nil {
3335
return err
3436
}
35-
log.Printf("[DEBUG] Cloning: https://aperture.section.io/account/%d/application/%d/%s.git ...\n", c.AccountID, c.AppID, app.ApplicationName)
36-
tempDir, err := ioutil.TempDir("", "sectinoctl-*")
37+
appName := strings.ReplaceAll(app.ApplicationName, "/", "")
38+
log.Printf("[DEBUG] Cloning: https://aperture.section.io/account/%d/application/%d/%s.git ...\n", c.AccountID, c.AppID, appName)
39+
tempDir, err := ioutil.TempDir("", "sectionctl-*")
3740
if err != nil {
3841
return err
3942
}
@@ -46,7 +49,7 @@ func (g *GS) UpdateGitViaGit(c *DeployCmd, response UploadResponse) error {
4649
payload := PayloadValue{ID: response.PayloadID}
4750
branchRef := fmt.Sprintf("refs/heads/%s",c.Environment)
4851
r, err := git.PlainClone(tempDir, false, &git.CloneOptions{
49-
URL: fmt.Sprintf("https://aperture.section.io/account/%d/application/%d/%s.git", c.AccountID, c.AppID, app.ApplicationName),
52+
URL: fmt.Sprintf("https://aperture.section.io/account/%d/application/%d/%s.git", c.AccountID, c.AppID, appName),
5053
Auth: gitAuth,
5154
Progress: os.Stdout,
5255
ReferenceName: plumbing.ReferenceName(branchRef),

0 commit comments

Comments
 (0)