diff options
| author | Paul Buetow <paul@buetow.org> | 2025-06-23 23:40:11 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-06-23 23:40:11 +0300 |
| commit | 2caf07a82d89c8f3e0ecb3bdc6662bd757600b22 (patch) | |
| tree | d2aec15ccbb3dce9e15347dcfb7a5be124d5114c /internal/sync | |
| parent | 42d3df9fe18663f5c6f7067b964f0b09071910e6 (diff) | |
Improve merge conflict error message with directory path
- Show full absolute path to the repository with conflicts
- Provide clear instructions on how to resolve or delete the directory
- Make error message more actionable for users
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'internal/sync')
| -rw-r--r-- | internal/sync/sync.go | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/internal/sync/sync.go b/internal/sync/sync.go index a22089d..703987e 100644 --- a/internal/sync/sync.go +++ b/internal/sync/sync.go @@ -257,16 +257,12 @@ func (s *Syncer) syncBranch(branch string, remotes map[string]*config.Organizati // Check for merge conflicts statusStr := string(output) if strings.Contains(statusStr, "UU ") || strings.Contains(statusStr, "AA ") || strings.Contains(statusStr, "DD ") { - // Get the repo name from the work directory - repoName := filepath.Base(s.workDir) - if repoName == ".gitsyncer-work" || repoName == "" { - // If we're in the work directory itself, extract from current directory - cmd := exec.Command("git", "rev-parse", "--show-toplevel") - if output, err := cmd.Output(); err == nil { - repoName = filepath.Base(strings.TrimSpace(string(output))) - } + // Get absolute path for clarity + absPath, err := filepath.Abs(s.workDir) + if err != nil { + absPath = s.workDir } - return fmt.Errorf("repository has unresolved merge conflicts - please resolve manually or delete %s", s.workDir) + return fmt.Errorf("repository has unresolved merge conflicts\nPlease resolve conflicts in: %s\nOr delete the directory to start fresh: rm -rf %s", absPath, absPath) } // If we have uncommitted changes but no conflicts, try to stash them fmt.Println(" Stashing uncommitted changes...") |
