blameFile
지정된 경로의 파일에 대한 blame 개체를 생성해요
시그니처
ts
class Repository {
blameFile(path: string, options?: BlameOptions): Blame;
}파라미터
- path필수 · string
blame할 파일의 경로
- optionsnull | BlameOptions
blame 동작을 제어하는 옵션
- firstParentboolean
첫 번째 부모만 따라가며 도달 가능한 커밋으로 검색을 제한해요.
- ignoreWhitespaceboolean
공백 차이를 무시해요.
- maxLinenumber
blame할 최대 줄 번호 (1부터 시작하는 인덱스)
- minLinenumber
blame할 최소 줄 번호 (1부터 시작하는 인덱스)
- newestCommitstring
고려할 가장 최신 커밋의 oid. blame 알고리즘은 이 커밋에 도달하면 중단해요.
- oldestCommitstring
고려할 가장 오래된 커밋의 oid. blame 알고리즘은 이 커밋에 도달하면 중단해요.
- pathstring
작업 중인 파일의 경로. 경로는 리포지토리 루트에 상대적이어야 해요.
- trackCopiesAnyCommitCopiesboolean
어떤 커밋에든 존재하는 다른 파일에서 복사된 줄을 추적해요.
- trackCopiesSameCommitCopiesboolean
같은 커밋에 존재하는 다른 파일에서 복사된 줄을 추적해요.
- trackCopiesSameCommitMovesboolean
같은 커밋에서 파일 간에 이동한 줄을 추적해요.
- trackLinesMovementboolean
파일 내에서 이동한 줄을 추적해요. 이것은 git-blame -M 옵션이에요.
- useMailmapboolean
mailmap 파일을 사용하여 작성자와 커미터의 이름과 이메일 주소를 정식 실명과 이메일 주소로 매핑해요.
- firstParentboolean
반환 값
- Blame
지정된 파일에 대한 Blame 개체
에러
- Error
파일이 존재하지 않거나 열 수 없는 경우
예제
ts
// 전체 파일을 blame
const blame = repo.blameFile('path/to/file.js');
// 한 줄만 blame
const lineBlame = repo.blameFile('path/to/file.js', { minLine: 10, maxLine: 10 });
// 줄 범위를 blame
const rangeBlame = repo.blameFile('path/to/file.js', { minLine: 5, maxLine: 15 });