Skip to content

muesli/gitcha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gitcha

Latest Release Build Status Coverage Status Go ReportCard GoDoc

Go helpers to work with git repositories

Examples

import "github.com/muesli/gitcha"

// returns the directory of the git repository path is a member of:
repo, err := gitcha.GitRepoForPath(path)

// finds files from list in path. It respects all .gitignores it finds while
// traversing paths:
ch, err := gitcha.FindFiles(path, []string{"*.md"})
for v := range ch {
    fmt.Println(v.Path)
}

// finds files, excluding any matches in a given set of ignore patterns:
ch, err := gitcha.FindFilesExcept(path, []string{"*.md"}, []string{".*"})
...

// if you are only interested in the first match:
result, err := gitcha.FindFirstFile(path, []string{"*.md"})
...

// just for convenience:
ok := gitcha.IsPathInGit(path)