Fix up file reseting
This commit is contained in:
10
main.go
10
main.go
@@ -270,9 +270,15 @@ func cleanupGitFiles(files []string) error {
|
||||
logger.Printf("Successfully committed file: %s with message: 'Track %s'", filename, filename)
|
||||
} else {
|
||||
logger.Printf("File %s is already tracked. Restoring it to the working tree.", file)
|
||||
worktree.Restore(&git.RestoreOptions{
|
||||
Files: []string{file},
|
||||
err := worktree.Restore(&git.RestoreOptions{
|
||||
Files: []string{file},
|
||||
Staged: true,
|
||||
Worktree: true,
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error restoring file: %v\n", err)
|
||||
return fmt.Errorf("error restoring file: %w", err)
|
||||
}
|
||||
logger.Printf("File %s restored successfully.", file)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user