gitutil

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddGitignoreToWorktree

func AddGitignoreToWorktree(wt *git.Worktree, repositoryPath string) error

AddGitignoreToWorktree adds the exclude paths in the .gitignore file to the worktree. This is a workaround for https://github.com/go-git/go-git/issues/597. If we don't call this before doing add all then the ignore patterns won't be respected.

N.B. It looks like we also need to call this function if we want IsClean to ignore files N.B this doesn't work with nested .gitignore files.

func CommitAll added in v0.0.2

func CommitAll(r *git.Repository, w *git.Worktree, message string) error

CommitAll is a helper function to commit all changes in the repository. null op if its clean. w is the worktree You should call AddGitIgnore on the worktree before calling this function if you want to ensure files are ignored. TODO(jeremy): I'm not sure this is the right API. I did it this way because on some repositories it was really slow to get the worktree and add .gitignore so I didn't want to do that more than once. https://github.com/jlewi/hydros/issues/84 is tracking the slowness.

func LocateRoot

func LocateRoot(origPath string) (string, error)

LocateRoot locates the root of the git repository at path. Returns empty string if not a git repo.

func TrackedIsClean added in v0.0.2

func TrackedIsClean(gitStatus git.Status) bool

TrackedIsClean returns true if the repository is clean except for untracked files. git.IsClean doesn't work because it doesn't ignore untracked files.

Types

type User

type User struct {
	Name  string
	Email string
}

func LoadUser

func LoadUser(r *git.Repository) (*User, error)

LoadUser gets the user information for the repository.

Jump to

Keyboard shortcuts

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