Skip to content

csmith/gitrefs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gitrefs

Provides a simple way to list references from a remote git repository over HTTP, without needing a full git client or a checkout of the remote repository.

Example:

package main

import (
	"fmt"

	"github.com/csmith/gitrefs"
)

func main() {
	refs, err := gitrefs.Fetch("https://github.com/csmith/gitrefs")
	if err != nil {
		panic(err)
	}

	for r := range refs {
		fmt.Printf("Ref %s at commit %s\n", r, refs[r])
	}
}

A utility method to retrieve only the latest semver tag is included:

package main

import (
	"fmt"

	"github.com/csmith/gitrefs"
)

func main() {
	tag, hash, err := gitrefs.LatestTag("https://github.com/csmith/gitrefs")
	if err != nil {
		panic(err)
	}

	fmt.Printf("Latest tag is %s at commit %s\n", tag, hash)
}

Protocol docs:

About

List references from repote git repos in go

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages