Skip to content

Commit c0aa72b

Browse files
committed
Handle files with colons in WalkGitLog
1 parent 3361bbf commit c0aa72b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

modules/git/log_name_status.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ func LogNameStatusRepo(ctx context.Context, repository, head, treepath string, p
5656
} else if treepath != "" {
5757
files = append(files, treepath)
5858
}
59+
// Escape colons at the start of filenames, because `git log -- :filename` returns nothing
60+
for i, file := range files {
61+
if strings.HasPrefix(file, ":") {
62+
files[i] = "\\" + file
63+
}
64+
}
5965
cmd.AddDashesAndList(files...)
6066

6167
go func() {

0 commit comments

Comments
 (0)