code: func findMatchInFile(file *object.File, treeName string, opts *GrepOptions) ([]GrepResult, error) {
  	var grepResults []GrepResult
  
  	content, err := file.Contents()
  	if err != nil {
  		return grepResults, err
  	}
  
  	// Split the file content and parse line-by-line.
  	contentByLine := strings.Split(content, "\n")
  	for lineNum, cnt := range contentByLine {
  		addToResult := false
  
  		// Match the patterns and content. Break out of the loop once a
  		// match is found.
  		for _, pattern := range opts.Patterns {
  			if pattern != nil && pattern.MatchString(cnt) {
  				// Add to result only if invert match is not enabled.
  				if !opts.InvertMatch {
  					addToResult = true
  					break
  				}
  			} else if opts.InvertMatch {
  				// If matching fails, and invert match is enabled, add to
  				// results.
  				addToResult = true
  				break
  			}
  		}
  
  		if addToResult {
  			grepResults = append(grepResults, GrepResult{
  				FileName:   file.Name,
  				LineNumber: lineNum + 1,
  				Content:    cnt,
  				TreeName:   treeName,
  			})
  		}
  	}
  
  	return grepResults, nil
  }
docs: // findMatchInFile takes a single File, worktree name and GrepOptions,
  // and returns a slice of GrepResult containing the result of regex pattern
  // matching in the given file.