summaryrefslogtreecommitdiff
path: root/internal/sync/git_operations.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-10-31 20:13:32 +0200
committerPaul Buetow <paul@buetow.org>2025-10-31 20:13:32 +0200
commit11eea6a82cbfdde40ec1457c6ea080da4da6b7dc (patch)
tree8026068f6a3beb3ee02c45f06f4487f4b89caaf1 /internal/sync/git_operations.go
parent5c3e0b5cf99d028c4f06be7a825388b296e37a22 (diff)
feat: implement amp AI tool support and replace Taskfile with Magev0.10.0
- Add amp as default AI tool for release notes and showcase generation - Fallback chain: amp → hexai → claude → aichat - Replace Taskfile.yaml with magefile.go for build automation - Update all documentation (README.md, AGENTS.md, doc/development.md) - Update version to 0.10.0 Amp-Thread-ID: https://ampcode.com/threads/T-735ba1e2-0255-4b43-8ed1-6c0d2f78301b Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'internal/sync/git_operations.go')
-rw-r--r--internal/sync/git_operations.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/internal/sync/git_operations.go b/internal/sync/git_operations.go
index efa27f5..0bd698e 100644
--- a/internal/sync/git_operations.go
+++ b/internal/sync/git_operations.go
@@ -242,24 +242,24 @@ func createSSHBareRepository(sshHost, repoPath string) error {
if len(parts) != 2 {
return fmt.Errorf("invalid SSH host format: %s", sshHost)
}
-
+
userHost := parts[0]
basePath := parts[1]
-
+
// Full path to the repository
fullRepoPath := fmt.Sprintf("%s/%s.git", basePath, repoPath)
-
+
fmt.Printf("Creating bare repository at %s:%s\n", userHost, fullRepoPath)
-
+
// Create the repository directory and initialize as bare
commands := fmt.Sprintf("mkdir -p %s && cd %s && git init --bare", fullRepoPath, fullRepoPath)
cmd := exec.Command("ssh", userHost, commands)
output, err := cmd.CombinedOutput()
-
+
if err != nil {
return fmt.Errorf("failed to create bare repository: %w\n%s", err, string(output))
}
-
+
fmt.Printf("Successfully created bare repository at %s:%s\n", userHost, fullRepoPath)
return nil
}
@@ -280,18 +280,18 @@ func pushBranchWithBackupSupport(remoteName, branch string, remoteHasBranch bool
if err != nil {
return fmt.Errorf("failed to get remote URL: %w", err)
}
-
+
// Extract repo name from URL
repoName := extractRepoName(remoteURL)
if repoName == "" {
return fmt.Errorf("failed to extract repository name from URL: %s", remoteURL)
}
-
+
// Create the bare repository
if err := createSSHBareRepository(org.Host, repoName); err != nil {
return fmt.Errorf("failed to create SSH repository: %w", err)
}
-
+
// Try pushing again
cmd = exec.Command("git", "push", remoteName, branch, "--tags")
if err := cmd.Run(); err != nil {
@@ -300,7 +300,7 @@ func pushBranchWithBackupSupport(remoteName, branch string, remoteHasBranch bool
fmt.Printf(" Successfully pushed to newly created backup repository\n")
return nil
}
-
+
fmt.Printf(" Note: Remote repository %s does not exist - must be created manually\n", remoteName)
fmt.Printf(" Skipping push to %s\n", remoteName)
return nil // Not an error, just skip
@@ -341,7 +341,7 @@ func getRemoteURL(remoteName string) (string, error) {
func extractRepoName(url string) string {
// Remove .git suffix if present
url = strings.TrimSuffix(url, ".git")
-
+
// Extract the last component of the path
parts := strings.Split(url, "/")
if len(parts) > 0 {