gitrefs

package
v0.0.0-...-315b8f4 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package gitrefs gets refs from a git repo (like git ls-remote) https://github.com/git/git/blob/master/Documentation/technical/http-protocol.txt https://github.com/git/git/blob/master/Documentation/technical/pack-protocol.txt

Index

Constants

This section is empty.

Variables

View Source
var AllProtos = []Proto{HTTPProto{}, GitProto{}, FileProto{}}

AllProtos all protocols FileProto might be dangerous if you don't control the url

Functions

This section is empty.

Types

type FileProto

type FileProto struct{}

FileProto implements reading local git repo

func (FileProto) Refs

func (f FileProto) Refs(u *url.URL) ([]Ref, error)

Refs from file repo

type GitProto

type GitProto struct{}

GitProto implements gits own protocol

func (GitProto) Refs

func (GitProto) Refs(u *url.URL) ([]Ref, error)

Refs from git repo

type HTTPProto

type HTTPProto struct {
	Client *http.Client // http.DefaultClient if nil
}

HTTPProto implements git http protocol

func (HTTPProto) Refs

func (h HTTPProto) Refs(u *url.URL) ([]Ref, error)

Refs from http repo

type Proto

type Proto interface {
	Refs(u *url.URL) ([]Ref, error)
}

Proto is a git protocol

type Ref

type Ref struct {
	Name  string
	ObjID string
}

Ref is name/object id pair

func GITProtocol

func GITProtocol(u *url.URL, rw io.ReadWriter) ([]Ref, error)

GITProtocol talk native git protocol 000eversion 1 00887217a7c7e582c46cec22a130adf4b9d7d950fba0 HEAD\0multi_ack thin-pack side-band side-band-64k ofs-delta shallow no-progress include-tag 00441d3fcd5ced445d1abc402225c0b8a1299641f497 refs/heads/integration 003f7217a7c7e582c46cec22a130adf4b9d7d950fba0 refs/heads/master 003cb88d2441cac0977faf98efc80305012112238d9d refs/tags/v0.9 003c525128480b96c89e6418b1e40909bf6c5b2d580f refs/tags/v1.0 003fe92df48743b7bc7d26bcaabfddde0a1e20cae47c refs/tags/v1.0^{} 0000

func HTTPDumbProtocol

func HTTPDumbProtocol(r io.Reader) ([]Ref, error)

HTTPDumbProtocol talk git dump HTTP protocol 95dcfa3633004da0049d3d0fa03f80589cbcaf31\trefs/heads/maint\n d049f6c27a2244e12041955e262a404c7faba355\trefs/heads/master\n 2cb58b79488a98d2721cea644875a8dd0026b115\trefs/tags/v1.0\n a3c2e2402b99163d1d59756e5f207ae21cccba4c\trefs/tags/v1.0^{}\n

func HTTPSmartProtocol

func HTTPSmartProtocol(r io.Reader) ([]Ref, error)

HTTPSmartProtocol talk git HTTP protocol 001e# service=git-upload-pack\n 0000 004895dcfa3633004da0049d3d0fa03f80589cbcaf31 refs/heads/maint\0multi_ack\n 003fd049f6c27a2244e12041955e262a404c7faba355 refs/heads/master\n 003c2cb58b79488a98d2721cea644875a8dd0026b115 refs/tags/v1.0\n 003fa3c2e2402b99163d1d59756e5f207ae21cccba4c refs/tags/v1.0^{}\n 0000

func Refs

func Refs(rawurl string, protos []Proto) ([]Ref, error)

Refs fetches refs for a remote repo (like git ls-remote)

Directories

Path Synopsis
Package pktline implements git pktline format https://github.com/git/git/blob/master/Documentation/technical/pack-protocol.txt Encoded as hexlen + string where len is 16 bit hex encoded len(string) + len(hexlen) Ex: "a" is "0005a" Ex: "" is "0000" (special case)
Package pktline implements git pktline format https://github.com/git/git/blob/master/Documentation/technical/pack-protocol.txt Encoded as hexlen + string where len is 16 bit hex encoded len(string) + len(hexlen) Ex: "a" is "0005a" Ex: "" is "0000" (special case)

Jump to

Keyboard shortcuts

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