Skip to content

Commit 42238dc

Browse files
committed
fix(gist): prevent fetching full content for already edited files
1 parent c98c435 commit 42238dc

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

pkg/cmd/gist/edit/edit.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,14 +260,17 @@ func editRun(opts *EditOptions) error {
260260
}
261261

262262
// If the file is truncated, fetch the full content
263+
// but only if it hasn't already been edited in this session
263264
file := gist.Files[filename]
264265
if file.Truncated {
265-
fullContent, err := shared.GetRawGistFile(client, file.RawURL)
266-
if err != nil {
267-
return err
268-
}
266+
if _, alreadyEdited := filesToUpdate[filename]; !alreadyEdited {
267+
fullContent, err := shared.GetRawGistFile(client, file.RawURL)
268+
if err != nil {
269+
return err
270+
}
269271

270-
gistFile.Content = fullContent
272+
gistFile.Content = fullContent
273+
}
271274
}
272275

273276
var text string

0 commit comments

Comments
 (0)