Fix up file reseting
This commit is contained in:
8
main.go
8
main.go
@@ -270,9 +270,15 @@ func cleanupGitFiles(files []string) error {
|
|||||||
logger.Printf("Successfully committed file: %s with message: 'Track %s'", filename, filename)
|
logger.Printf("Successfully committed file: %s with message: 'Track %s'", filename, filename)
|
||||||
} else {
|
} else {
|
||||||
logger.Printf("File %s is already tracked. Restoring it to the working tree.", file)
|
logger.Printf("File %s is already tracked. Restoring it to the working tree.", file)
|
||||||
worktree.Restore(&git.RestoreOptions{
|
err := worktree.Restore(&git.RestoreOptions{
|
||||||
Files: []string{file},
|
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)
|
logger.Printf("File %s restored successfully.", file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user