You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: diff.go
    path of file: ./repos/gitness/git/adapter
    
    the code of the file until where you have to start completion: // Copyright 2023 Harness, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of th
    
func cutLinesFromFullFileDiff(w io.Writer, r io.Reader, startLine, endLine int) error {
	if startLine < 0 {
		startLine = 0
	}

	if endLine < 0 {
		endLine = 0
	}

	if startLine == 0 && endLine > 0 {
		startLine = 1
	}

	if endLine < startLine {
		endLine = 0
	}

	// no need for processing lines just copy the data
	if startLine == 0 && endLine == 0 {
		_, err := io.Copy(w, r)
		return err
	}

	linePos := 0
	start := false
	scanner := bufio.NewScanner(r)
	for scanner.Scan() {
		line := scanner.Bytes()

		if start {
			linePos++
		}

		if endLine > 0 && linePos > endLine {
			break
		}

		if linePos > 0 &&
			(startLine > 0 && linePos < startLine) {
			continue
		}

		if len(line) >= 2 && bytes.HasPrefix(line, []byte{'@', '@'}) {
			hunk, ok := parser.ParseDiffHunkHeader(string(line)) // TBD: maybe reader?
			if !ok {
				return fmt.Errorf("failed to extract lines from diff, range [%d,%d] : %w",
					startLine, endLine, ErrParseDiffHunkHeader)
			}
			line = modifyHeader(hunk, startLine, endLine)
			start = true
		}

		if _, err := w.Write(line); err != nil {
			return err
		}

		if _, err := w.Write([]byte{'\n'}); err != nil {
			return err
		}
	}
	return scanner.Err()
}