Code polish

This commit is contained in:
2025-03-26 11:40:21 +01:00
parent 068c64d714
commit c22e6ff41f
2 changed files with 4 additions and 0 deletions

View File

@@ -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)