git

package
v0.0.0-...-f27dfd7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2026 License: BSD-2-Clause Imports: 19 Imported by: 0

Documentation

Overview

Package git provides API endpoints for git status and push operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Diff

Diff returns the diff for a specific commit

func DiscardAll

func DiscardAll(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

DiscardAll resets the repository to origin/master (discards all local changes)

func History

func History(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

History returns paginated commit history

func Pull

Pull fetches and merges changes from the remote origin

func Push

Push pushes commits to the remote origin

func RebuildIndex

func RebuildIndex(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

RebuildIndex manually triggers a full index rebuild

func ResetTo

func ResetTo(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

ResetTo resets the repository to a specific commit (hard reset)

func Status

Status returns unpushed commits (commits ahead of origin/master)

Types

type CommitInfo

type CommitInfo struct {
	Hash    string `json:"hash"`
	Message string `json:"message"`
	Author  string `json:"author"`
	Date    string `json:"date"`
}

CommitInfo contains details about a single Git commit.

type DiffResponse

type DiffResponse struct {
	Hash    string     `json:"hash"`
	Message string     `json:"message"`
	Author  string     `json:"author"`
	Date    string     `json:"date"`
	Files   []FileDiff `json:"files"`
}

DiffResponse contains the diff for a specific commit.

type FileDiff

type FileDiff struct {
	Name      string `json:"name"`
	Additions int    `json:"additions"`
	Deletions int    `json:"deletions"`
	Patch     string `json:"patch"`
}

FileDiff contains diff information for a single file.

type HistoryResponse

type HistoryResponse struct {
	Commits []CommitInfo `json:"commits"`
	HasMore bool         `json:"hasMore"`
	Page    int          `json:"page"`
}

HistoryResponse contains paginated commit history.

type PullPushResponse

type PullPushResponse struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
}

PullPushResponse contains the result of a pull or push operation.

type StatusResponse

type StatusResponse struct {
	Ahead   int          `json:"ahead"`
	Commits []CommitInfo `json:"commits"`
	Remote  string       `json:"remote"`
}

StatusResponse contains unpushed commit information.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL