Merge pull request #105817 from yylt/edit

Fix edit command
This commit is contained in:
Kubernetes Prow Robot 2021-11-08 09:15:20 -08:00 committed by GitHub
commit bafa87c553
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -725,7 +725,9 @@ func ManualStrip(file []byte) []byte {
stripped := []byte{}
lines := bytes.Split(file, []byte("\n"))
for i, line := range lines {
if bytes.HasPrefix(bytes.TrimSpace(line), []byte("#")) {
trimline := bytes.TrimSpace(line)
if bytes.HasPrefix(trimline, []byte("#")) && !bytes.HasPrefix(trimline, []byte("#!")) {
continue
}
stripped = append(stripped, line...)