Skip to content

Commit 06b9eb3

Browse files
committed
fix build
1 parent 68cc652 commit 06b9eb3

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

modules/git/commit_submodule_file.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ func (sf *CommitSubModuleFile) RefID() string {
115115
return sf.refID
116116
}
117117

118+
// SubModuleCommit submodule name and commit from a repository
119+
type SubModuleCommit struct {
120+
Name string
121+
Commit string
122+
}
123+
118124
// GetSubmoduleCommits Returns a list of active submodules in the repository
119125
func GetSubmoduleCommits(ctx context.Context, repoPath string) []SubModuleCommit {
120126
stdoutReader, stdoutWriter := io.Pipe()
@@ -164,8 +170,7 @@ func GetSubmoduleCommits(ctx context.Context, repoPath string) []SubModuleCommit
164170
}
165171

166172
// If no commit was found for the module skip it
167-
commit, _, err := NewCommand(ctx, "submodule", "status", name).
168-
RunStdString(&RunOpts{Dir: repoPath})
173+
commit, _, err := NewCommand(ctx, "submodule", "status").AddDynamicArguments(name).RunStdString(&RunOpts{Dir: repoPath})
169174
if err != nil {
170175
log.Debug("Submodule %s skipped because it has no commit", name)
171176
continue
@@ -198,7 +203,7 @@ func GetSubmoduleCommits(ctx context.Context, repoPath string) []SubModuleCommit
198203
// AddSubmoduleIndexes Adds the given submodules to the git index. Requires the .gitmodules file to be already present.
199204
func AddSubmoduleIndexes(ctx context.Context, repoPath string, submodules []SubModuleCommit) error {
200205
for _, submodule := range submodules {
201-
if stdout, _, err := NewCommand(ctx, "update-index", "--add", "--cacheinfo", "160000", submodule.Commit, submodule.Name).
206+
if stdout, _, err := NewCommand(ctx, "update-index", "--add", "--cacheinfo", "160000").AddDynamicArguments(submodule.Commit, submodule.Name).
202207
RunStdString(&RunOpts{Dir: repoPath}); err != nil {
203208
log.Error("Unable to add %s as submodule to repo %s: stdout %s\nError: %v", submodule.Name, repoPath, stdout, err)
204209
return err

0 commit comments

Comments
 (0)