Skip to content

Commit 0317dcd

Browse files
authored
Merge pull request #77 from phantom5099/fork-pr-646-1778861239
fix(repository): normalize backslashes in git HEAD blob spec
2 parents f849504 + d78c3ed commit 0317dcd

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

internal/repository/git_diff.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ func isDirectoryGitDiffPath(workdir string, relativePath string) bool {
195195

196196
// buildGitHeadBlobSpec 构造 HEAD blob 读取使用的对象说明。
197197
func buildGitHeadBlobSpec(path string) string {
198-
normalized := strings.TrimPrefix(filepath.ToSlash(strings.TrimSpace(path)), "./")
198+
trimmed := strings.TrimSpace(path)
199+
normalized := strings.TrimPrefix(filepath.ToSlash(strings.ReplaceAll(trimmed, "\\", "/")), "./")
199200
return "HEAD:" + normalized
200201
}
201202

0 commit comments

Comments
 (0)