Skip to content

Commit

Permalink
fix: fix failed test case
Browse files Browse the repository at this point in the history
Signed-off-by: zongz <[email protected]>
  • Loading branch information
zong-zhe committed Jan 16, 2025
1 parent 9b611e3 commit 46cc322
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions pkg/downloader/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,11 @@ func (d *GitDownloader) Download(opts *DownloadOptions) error {
if gitSource == nil {
return errors.New("git source is nil")
}
// get the canonicalized git url
gitUrl, err := gitSource.GetCanonicalizedUrl()
if err != nil {
return err
}
cloneOpts := []git.CloneOption{
git.WithCommit(gitSource.Commit),
git.WithBranch(gitSource.Branch),
Expand Down Expand Up @@ -603,7 +608,7 @@ func (d *GitDownloader) Download(opts *DownloadOptions) error {
_, err := git.CloneWithOpts(
append(
cloneOpts,
git.WithRepoURL(gitSource.Url),
git.WithRepoURL(gitUrl),
git.WithLocalPath(cacheFullPath),
git.WithBare(true),
)...,
Expand Down Expand Up @@ -632,10 +637,10 @@ func (d *GitDownloader) Download(opts *DownloadOptions) error {
opts.LogWriter,
)
// If the cache is disabled, clone the repository from the remote git repository.
_, err := git.CloneWithOpts(
_, err = git.CloneWithOpts(
append(
cloneOpts,
git.WithRepoURL(gitSource.Url),
git.WithRepoURL(gitUrl),
git.WithLocalPath(opts.LocalPath),
)...,
)
Expand All @@ -654,12 +659,6 @@ func (d *GitDownloader) Download(opts *DownloadOptions) error {
return errors.New("git source is nil")
}

// get the canonicalized git url
gitUrl, err := gitSource.GetCanonicalizedUrl()
if err != nil {
return err
}

_, err = git.CloneWithOpts(
git.WithCommit(gitSource.Commit),
git.WithBranch(gitSource.Branch),
Expand Down

0 comments on commit 46cc322

Please sign in to comment.