Skip to content

Commit 7615191

Browse files
Update src/internal/git/operations.go
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 39c355b commit 7615191

1 file changed

Lines changed: 18 additions & 16 deletions

File tree

src/internal/git/operations.go

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -86,22 +86,24 @@ func GetChanges(config *types.RepoConfig) (string, error) {
8686
changes.WriteString("\n\n")
8787

8888
// Try to get content of untracked files (limited to text files and smaller size)
89-
untrackedFiles := strings.Split(strings.TrimSpace(string(untrackedOutput)), "\n")
90-
for _, file := range untrackedFiles {
91-
if file == "" {
92-
continue
93-
}
94-
95-
fullPath := filepath.Join(config.Path, file)
96-
if utils.IsTextFile(fullPath) && utils.IsSmallFile(fullPath) {
97-
fileContent, err := os.ReadFile(fullPath)
98-
if err == nil {
99-
changes.WriteString(fmt.Sprintf("Content of new file %s:\n", file))
100-
changes.WriteString(string(fileContent))
101-
changes.WriteString("\n\n")
102-
}
103-
}
104-
}
89+
untrackedFiles := strings.Split(strings.TrimSpace(string(untrackedOutput)), "\n")
90+
for _, file := range untrackedFiles {
91+
if file == "" {
92+
continue
93+
}
94+
95+
fullPath := filepath.Join(config.Path, file)
96+
if utils.IsTextFile(fullPath) && utils.IsSmallFile(fullPath) {
97+
fileContent, err := os.ReadFile(fullPath)
98+
if err != nil {
99+
// Log but don't fail - untracked file may have been deleted or is inaccessible
100+
continue
101+
}
102+
changes.WriteString(fmt.Sprintf("Content of new file %s:\n", file))
103+
changes.WriteString(string(fileContent))
104+
changes.WriteString("\n\n")
105+
}
106+
}
105107
}
106108

107109
// 4. Get recent commits for context

0 commit comments

Comments
 (0)