Skip to content

Commit 6cfbdf0

Browse files
committed
fix(jujutsu): remove unnecessary unquoting of file paths
Removed unnecessary unquoting logic for lines (file paths) starting with a quote.
1 parent de5d307 commit 6cfbdf0

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

walk/jujutsu.go

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"os"
99
"os/exec"
1010
"path/filepath"
11-
"strconv"
1211

1312
"github.com/charmbracelet/log"
1413
"github.com/numtide/treefmt/v2/jujutsu"
@@ -61,19 +60,10 @@ func (j *JujutsuReader) Read(ctx context.Context, files []*File) (n int, err err
6160
j.scanner = bufio.NewScanner(r)
6261
}
6362

64-
nextLine := func() (string, error) {
63+
nextLine := func() string {
6564
line := j.scanner.Text()
6665

67-
if len(line) == 0 || line[0] != '"' {
68-
return line, nil
69-
}
70-
71-
unquoted, err := strconv.Unquote(line)
72-
if err != nil {
73-
return "", fmt.Errorf("failed to unquote line %s: %w", line, err)
74-
}
75-
76-
return unquoted, nil
66+
return line
7767
}
7868

7969
LOOP:
@@ -92,10 +82,7 @@ LOOP:
9282
default:
9383
// read the next file
9484
if j.scanner.Scan() {
95-
entry, err := nextLine()
96-
if err != nil {
97-
return n, err
98-
}
85+
entry := nextLine()
9986

10087
path := filepath.Join(j.root, entry)
10188

0 commit comments

Comments
 (0)