gitdiff

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetStagedContent

func GetStagedContent(filePath string) (string, error)

GetStagedContent 는 git show 를 사용하여 파일의 스테이지된(인덱스) 내용을 반환합니다. 동일 경로는 캐싱하여 중복 git show 호출을 방지합니다.

func HasExtension

func HasExtension(path string, extensions []string) bool

HasExtension 는 path 가 주어진 파일 확장자 목록 중 하나를 가지는지 확인합니다. "dockerfile" 은 특수 식별자로, Dockerfile, Dockerfile.*, *.dockerfile 파일명 패턴에 매칭됩니다.

func ResetStagedContentCache added in v1.2.0

func ResetStagedContentCache()

ResetStagedContentCache: 콘텐츠 캐시를 초기화합니다 (테스트용).

Types

type FileDiff

type FileDiff struct {
	Path        string
	AddedLines  map[int]bool // 새 파일에서 추가된 줄 번호 집합 (1 기반)
	IsDeleted   bool
	IsSubmodule bool // git mode 160000 (서브모듈)
	IsSymlink   bool // git mode 120000 (심볼릭 링크)
}

FileDiff 는 스테이지된 diff 에서 파일 정보를 담습니다.

func GetStagedDiff

func GetStagedDiff() ([]FileDiff, error)

GetStagedDiff 는 git diff --staged 를 실행하고 파싱된 파일 diff 목록을 반환합니다.

func ParseDiff

func ParseDiff(diff string) []FileDiff

ParseDiff 는 통합 diff 출력을 파싱하여 추가된 줄 번호를 포함한 FileDiff 목록을 반환합니다.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL