Code polish
This commit is contained in:
3
main.go
3
main.go
@@ -200,6 +200,7 @@ func setupGit() error {
|
||||
}
|
||||
logger.Printf("Current working directory obtained: %s", cwd)
|
||||
|
||||
logger.Printf("Attempting to open git repository at %s", cwd)
|
||||
repo, err = git.PlainOpen(cwd)
|
||||
if err != nil {
|
||||
logger.Printf("No existing git repository found at %s, attempting to initialize a new git repository.", cwd)
|
||||
@@ -212,6 +213,7 @@ func setupGit() error {
|
||||
logger.Printf("Successfully opened existing git repository at %s", cwd)
|
||||
}
|
||||
|
||||
logger.Printf("Attempting to obtain worktree for repository at %s", cwd)
|
||||
worktree, err = repo.Worktree()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to obtain worktree for repository at %s: %w", cwd, err)
|
||||
@@ -241,6 +243,7 @@ func expandFilePatterns(patterns []string) ([]string, error) {
|
||||
|
||||
func cleanupGitFiles(files []string) error {
|
||||
for _, file := range files {
|
||||
logger.Printf("Checking file: %s", file)
|
||||
status, err := worktree.Status()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error getting worktree status: %v\n", err)
|
||||
|
Reference in New Issue
Block a user