From 2caf07a82d89c8f3e0ecb3bdc6662bd757600b22 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 23 Jun 2025 23:40:11 +0300 Subject: Improve merge conflict error message with directory path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- internal/sync/sync.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'internal') 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...") -- cgit v1.2.3