Skip to content

Commit e5edcc1

Browse files
committed
Change to use the :(literal) magic instead of escaping
1 parent c0aa72b commit e5edcc1

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

modules/git/log_name_status.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,9 @@ 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
59+
// Use the :(literal) pathspec magic to handle edge cases with files named like ":file.txt" or "*.jpg"
6060
for i, file := range files {
61-
if strings.HasPrefix(file, ":") {
62-
files[i] = "\\" + file
63-
}
61+
files[i] = ":(literal)" + file
6462
}
6563
cmd.AddDashesAndList(files...)
6664

0 commit comments

Comments
 (0)