@@ -51,12 +51,12 @@ func InitWiki(ctx context.Context, repo *repo_model.Repository) error {
5151
5252// prepareGitPath try to find a suitable file path with file name by the given raw wiki name.
5353// return: existence, prepared file path with name, error
54- func prepareGitPath (gitRepo * git.Repository , defaultWikiBranch string , wikiPath WebPath ) (bool , string , error ) {
54+ func prepareGitPath (ctx context. Context , gitRepo * git.Repository , defaultWikiBranch string , wikiPath WebPath ) (bool , string , error ) {
5555 unescaped := string (wikiPath ) + ".md"
5656 gitPath := WebPathToGitPath (wikiPath )
5757
5858 // Look for both files
59- filesInIndex , err := gitRepo .LsTree (defaultWikiBranch , unescaped , gitPath )
59+ filesInIndex , err := gitRepo .LsTree (ctx , defaultWikiBranch , unescaped , gitPath )
6060 if err != nil {
6161 if strings .Contains (err .Error (), "Not a valid object name" ) {
6262 return false , gitPath , nil // branch doesn't exist
@@ -140,7 +140,7 @@ func updateWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model
140140 }
141141 }
142142
143- isWikiExist , newWikiPath , err := prepareGitPath (gitRepo , repo .DefaultWikiBranch , newWikiName )
143+ isWikiExist , newWikiPath , err := prepareGitPath (ctx , gitRepo , repo .DefaultWikiBranch , newWikiName )
144144 if err != nil {
145145 return err
146146 }
@@ -156,7 +156,7 @@ func updateWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model
156156 isOldWikiExist := true
157157 oldWikiPath := newWikiPath
158158 if oldWikiName != newWikiName {
159- isOldWikiExist , oldWikiPath , err = prepareGitPath (gitRepo , repo .DefaultWikiBranch , oldWikiName )
159+ isOldWikiExist , oldWikiPath , err = prepareGitPath (ctx , gitRepo , repo .DefaultWikiBranch , oldWikiName )
160160 if err != nil {
161161 return err
162162 }
@@ -295,7 +295,7 @@ func DeleteWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model
295295 return fmt .Errorf ("unable to read HEAD tree to index in: %s %w" , basePath , err )
296296 }
297297
298- found , wikiPath , err := prepareGitPath (gitRepo , repo .DefaultWikiBranch , wikiName )
298+ found , wikiPath , err := prepareGitPath (ctx , gitRepo , repo .DefaultWikiBranch , wikiName )
299299 if err != nil {
300300 return err
301301 }
0 commit comments