Skip to content

Commit

Permalink
add orgin back when clone repo (due to git submodule)
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-chenzz committed Oct 1, 2023
1 parent 45e57f0 commit 4b225f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions api/internal/git/cloner.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ func ClonerUsingGitExec(repoSpec *RepoSpec) error {
if err = r.run("init"); err != nil {
return err
}
// git submodule need origin
if err = r.run("remote", "add", "origin", repoSpec.CloneSpec()); err != nil {
return err
}
ref := "HEAD"
if repoSpec.Ref != "" {
ref = repoSpec.Ref
Expand Down
4 changes: 2 additions & 2 deletions api/krusty/remoteloader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ resources:
resources:
- file://$ROOT/with-submodule.git/submodule?ref=relative-submodule
`,
// TODO(annasong): Replace with simpleBuild once #5131 is fixed.
err: `failed to run '\S+/git submodule update --init --recursive'`,

expected: simpleBuild,
},
{
name: "has timeout",
Expand Down

0 comments on commit 4b225f6

Please sign in to comment.