Documentation
¶
Overview ¶
Package gitcmd has a bunch of convience functions to work with Git. Each machine should use it's own Git.
Index ¶
- type Git
- func (g *Git) Branch(br string) error
- func (g *Git) Checkout() error
- func (g *Git) Hash() string
- func (g *Git) IsCheckedOut() bool
- func (g *Git) OfInterest(data []byte, names []string) bool
- func (g *Git) Pull(names []string) (bool, error)
- func (g *Git) RemoveAll() error
- func (g *Git) Rollback(hash string) error
- func (g *Git) Stash() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Git ¶
type Git struct {
// contains filtered or unexported fields
}
func (*Git) Checkout ¶
Checkout will do the initial check of the git repo. If the g.dir directory already exist and has a .git subdirectory, it will assume the checkout has been done during a previuos run.
func (*Git) Hash ¶
Hash returns the git hash of HEAD in the repo in g.dir. Empty string is returned in case of an error. The hash is always truncated to 8 hex digits.
func (*Git) IsCheckedOut ¶
func (*Git) OfInterest ¶
OfInterest will grep the diff stat for directories we care about. The returns boolen is true when we find a hit.
We do a git pull, but we want to know if things changed that are of interest. This is done by parsing the diffstat on the git pull, not the best way, but it works. Problem is here is to keep track _when_ things changed, i.e. we can look in the revlog, but then we need to track that we saw a change. Parsing the diff stat seems simpler and more atomic in that regard.
func (*Git) Pull ¶
Pull pulls from upstream. If the returned bool is true there were updates if on the files named in names.