Add repo sync

Change-Id: I6b61873c97e9ff46a699151fc52aa937248bcf81
diff --git a/server/git/gerrit.go b/server/git/gerrit.go
index d1d029f..d9f1f38 100644
--- a/server/git/gerrit.go
+++ b/server/git/gerrit.go
@@ -152,7 +152,7 @@
 	}
 
 	url := fmt.Sprintf("%s/a/changes/", g.config.BaseURL)
-	
+
 	// Log change creation with structured data
 	g.logger.Info("Creating Gerrit change",
 		slog.String("url", url),
diff --git a/server/git/git.go b/server/git/git.go
index 29cee16..9ee3074 100644
--- a/server/git/git.go
+++ b/server/git/git.go
@@ -32,6 +32,7 @@
 	Checkout(ctx context.Context, ref string) error
 	DeleteBranch(ctx context.Context, name string, force bool) error
 	GetCurrentBranch(ctx context.Context) (string, error)
+	GetUpstreamBranch(ctx context.Context, branch string) (string, error)
 
 	// Commit operations
 	Add(ctx context.Context, paths []string) error
@@ -394,6 +395,22 @@
 	return strings.TrimSpace(output), nil
 }
 
+// GetUpstreamBranch returns the upstream branch for a given branch
+func (g *Git) GetUpstreamBranch(ctx context.Context, branch string) (string, error) {
+	cmd := exec.CommandContext(ctx, "git", "rev-parse", "--abbrev-ref", branch+"@{upstream}")
+	cmd.Dir = g.repoPath
+	output, err := g.runCommandWithOutput(cmd, "rev-parse")
+	if err != nil {
+		return "", err
+	}
+
+	// The output will be in format "origin/branch-name", we want just "branch-name"
+	upstream := strings.TrimSpace(output)
+	upstream = strings.TrimPrefix(upstream, "origin/")
+
+	return upstream, nil
+}
+
 // Add stages files for commit
 func (g *Git) Add(ctx context.Context, paths []string) error {
 	args := append([]string{"add"}, paths...)
diff --git a/server/git/github.go b/server/git/github.go
index a73c4c6..87ec363 100644
--- a/server/git/github.go
+++ b/server/git/github.go
@@ -114,10 +114,10 @@
 
 // GitHub webhook API types
 type githubWebhookRequest struct {
-	Name   string                `json:"name"`
-	Active bool                  `json:"active"`
-	Events []string              `json:"events"`
-	Config githubWebhookConfig   `json:"config"`
+	Name   string              `json:"name"`
+	Active bool                `json:"active"`
+	Events []string            `json:"events"`
+	Config githubWebhookConfig `json:"config"`
 }
 
 type githubWebhookConfig struct {