git

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package git finds the Git repository a folder belongs to and its origin remote by reading the repository's files. It never runs the git command: the person may have Git only inside GitHub Desktop or an editor, and an app started from the desktop may not see the git their terminal runs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Inspect(ctx context.Context, path string) (Repository, error)
}

type FileClient added in v0.10.0

type FileClient struct{}

FileClient reads a repository's .git directory, or the .git file of a worktree or submodule, and its config.

func NewClient added in v0.10.0

func NewClient() FileClient

func (FileClient) Inspect added in v0.10.0

func (FileClient) Inspect(ctx context.Context, path string) (Repository, error)

Inspect finds the nearest folder at or above path that holds .git, as git does. A folder outside any repository is not an error: HasGit is false.

type Repository

type Repository struct {
	Root      string
	OriginURL string
	HasGit    bool
	HasRemote bool
}

Jump to

Keyboard shortcuts

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