@@ -119,7 +119,7 @@ func (repo *Repository) GetCompareInfo(ctx context.Context, basePath, baseBranch
119119 // Count number of changed files.
120120 // This probably should be removed as we need to use shortstat elsewhere
121121 // Now there is git diff --shortstat but this appears to be slower than simply iterating with --nameonly
122- compareInfo .NumFiles , err = repo .GetDiffNumChangedFiles (remoteBranch , headBranch , directComparison )
122+ compareInfo .NumFiles , err = repo .GetDiffNumChangedFiles (ctx , remoteBranch , headBranch , directComparison )
123123 if err != nil {
124124 return nil , err
125125 }
@@ -139,7 +139,7 @@ func (l *lineCountWriter) Write(p []byte) (n int, err error) {
139139
140140// GetDiffNumChangedFiles counts the number of changed files
141141// This is substantially quicker than shortstat but...
142- func (repo * Repository ) GetDiffNumChangedFiles (base , head string , directComparison bool ) (int , error ) {
142+ func (repo * Repository ) GetDiffNumChangedFiles (ctx context. Context , base , head string , directComparison bool ) (int , error ) {
143143 // Now there is git diff --shortstat but this appears to be slower than simply iterating with --nameonly
144144 w := & lineCountWriter {}
145145 stderr := new (bytes.Buffer )
@@ -151,7 +151,7 @@ func (repo *Repository) GetDiffNumChangedFiles(base, head string, directComparis
151151
152152 // avoid: ambiguous argument 'refs/a...refs/b': unknown revision or path not in the working tree. Use '--': 'git <command> [<revision>...] -- [<file>...]'
153153 if err := NewCommand ("diff" , "-z" , "--name-only" ).AddDynamicArguments (base + separator + head ).AddArguments ("--" ).
154- Run (repo . Ctx , & RunOpts {
154+ Run (ctx , & RunOpts {
155155 Dir : repo .Path ,
156156 Stdout : w ,
157157 Stderr : stderr ,
@@ -161,7 +161,7 @@ func (repo *Repository) GetDiffNumChangedFiles(base, head string, directComparis
161161 // previously it would return the results of git diff -z --name-only base head so let's try that...
162162 w = & lineCountWriter {}
163163 stderr .Reset ()
164- if err = NewCommand ("diff" , "-z" , "--name-only" ).AddDynamicArguments (base , head ).AddArguments ("--" ).Run (repo . Ctx , & RunOpts {
164+ if err = NewCommand ("diff" , "-z" , "--name-only" ).AddDynamicArguments (base , head ).AddArguments ("--" ).Run (ctx , & RunOpts {
165165 Dir : repo .Path ,
166166 Stdout : w ,
167167 Stderr : stderr ,
0 commit comments