Documentation
¶
Index ¶
- Constants
- Variables
- type CacheTreeEntry
- type ExtensionHeader
- type FetchedRef
- type Index
- func (index *Index) AddEntry(name string, data IndexEntryData)
- func (index *Index) CreateCacheTreeEntry(path string, sha1 [Sha1Len]byte) *CacheTreeEntry
- func (index *Index) NumEntries() int
- func (index *Index) Read(r io.Reader, totalSize int64) error
- func (index *Index) UpdateTree(cacheTreeEntry *CacheTreeEntry, numEntries, numSubtrees int)
- func (index *Index) Write(w io.Writer) error
- type IndexEntry
- type IndexEntryData
- type IndexHeader
- type IndexSha1
- type IndexSignature
- type ObjectTypeName
- type ObjectTypeNameStreamItem
- type RevListObjects
- type ShellGit
- func (s *ShellGit) AddConfig(repoPath string, key, value string) error
- func (s *ShellGit) AddFetchRefSpec(repoPath, remoteName, refSpec string) error
- func (s *ShellGit) AddRemote(repoPath, remoteName, url string) error
- func (s *ShellGit) AllCommitsDates(repoPath string) (hashes []entities.Hash, dates []time.Time, returnErr error)
- func (s *ShellGit) AllObjects(repoPath string) (objects []entities.Hash, returnErr error)
- func (s *ShellGit) Checkout(repoPath string, ref string) error
- func (s *ShellGit) CheckoutNewBranch(repoPath, branch, tracking string) error
- func (s *ShellGit) CommitTreeHashes(repoPath string, commits []entities.Hash) ([]entities.Hash, error)
- func (s *ShellGit) CommitsFileObjects(repoPath string, commits []entities.Hash) (hashes []entities.Hash, returnErr error)
- func (s *ShellGit) CurrentBranch(repoPath string) (branch, remote string, err error)
- func (s *ShellGit) Fetch(repoPath string) error
- func (s *ShellGit) FetchAndGetUpdatedRefs(repoPath string) ([]*FetchedRef, error)
- func (s *ShellGit) FetchRef(repoPath string, remote string, ref string) error
- func (s *ShellGit) GetAllConfigs(repoPath, key string) ([]string, error)
- func (s *ShellGit) GetConfig(repoPath string, key, defValue string) (string, error)
- func (s *ShellGit) GetObjCount(repoPath, rev string, excludes []entities.Hash) (int64, error)
- func (s *ShellGit) GetRemotes(repoPath string) ([]string, error)
- func (s *ShellGit) GitCloneBareWithWorktree(ctx context.Context, gitDir, workTree, targetURL, remoteName, ref string) error
- func (s *ShellGit) GitCloneBranchAt(ctx context.Context, repoPath, targetURL, branch string) error
- func (s *ShellGit) GitCloneCommitAt(repoPath, targetURL, remoteName, ref string) error
- func (s *ShellGit) HasUncommitedChanges(repoPath string) (bool, error)
- func (s *ShellGit) InstallLFSHooks(repoPath string) error
- func (s *ShellGit) LFSEnabled() bool
- func (s *ShellGit) LFSFetch(repoPath string) error
- func (s *ShellGit) LFSFiles(repoPath string) (map[string][]string, error)
- func (s *ShellGit) LFSFilesAll(repoPath string) (map[string][]string, error)
- func (s *ShellGit) ListSymRefs(remote string) ([]string, []string, error)
- func (s *ShellGit) ListTreeRec(repoPath, ref string) ([]entities.DeepEntry, error)
- func (s *ShellGit) ObjectTypes(repoPath string, objects []entities.Hash) (types []string, returnErr error)
- func (s *ShellGit) ObjectsInTree(repoPath, ref string) ([]*ObjectTypeName, error)
- func (s *ShellGit) PackObjects(repoPath string, prefix string, objects []entities.Hash) (string, error)
- func (s *ShellGit) Rebase(repoPath string, onto string) error
- func (s *ShellGit) RebaseOnto(repoPath string, newbase, oldbase, tip string) error
- func (s *ShellGit) RemoveRemote(repoPath, remoteName string) error
- func (s *ShellGit) RenameRemote(repoPath, old, new string) error
- func (s *ShellGit) ResetSoft(repoPath string, target string) error
- func (s *ShellGit) RevListAll(repoPath string) ([]entities.Hash, error)
- func (s *ShellGit) RevListObjects(repoPath string, includedCommits, excludedCommits []entities.Hash) (*RevListObjects, error)
- func (s *ShellGit) RevListObjectsTopoOrder(repoPath, rev string, excludes []entities.Hash) (<-chan ObjectTypeNameStreamItem, error)
- func (s *ShellGit) RevListReverse(repoPath, from, to string) ([]string, error)
- func (s *ShellGit) RevParse(repoPath string, ref string) (string, error)
- func (s *ShellGit) SetSymbolicRef(repoPath, name, ref string) error
- func (s *ShellGit) ShowRefs(repoPath string) (map[string]entities.Hash, error)
- func (s *ShellGit) StashPop(repoPath string) error
- func (s *ShellGit) StashPush(repoPath string) error
- func (s *ShellGit) SymRef(repoPath string, ref string) (string, error)
- func (s *ShellGit) SymbolicRef(repoPath string, ref string, short bool) (string, error)
- func (s *ShellGit) TryRemoveRemote(repoPath, remoteName string) error
- func (s *ShellGit) UnsetUpstream(repoPath string, branch string) error
- func (s *ShellGit) UpdateIndex(repoPath, file string) error
- func (s *ShellGit) UpdateRef(repoPath, refName, commitHash string) error
Constants ¶
const ( Sha1Len = 20 // Length in bytes CacheTreeFillerBytes = 3 // 1 for NUL, 1 for space, and 1 for newline ExtensionHeaderSize = 8 )
Variables ¶
var ( IndexDircHeader = [4]byte{'D', 'I', 'R', 'C'} IndexTreeHeader = [4]byte{'T', 'R', 'E', 'E'} )
Functions ¶
This section is empty.
Types ¶
type CacheTreeEntry ¶
type CacheTreeEntry struct {
// Path relative to parent directory.
Path string `json:"path"`
// ASCII decimal number of index entries recursively present beneath this node.
EntryCount string `json:"entry_count"`
// ASCII decimal number of trees directly beneath this node.
SubtreeCount string `json:"subtree_count"`
Sha1 IndexSha1 `json:"sha1"`
}
func (*CacheTreeEntry) Entries ¶
func (e *CacheTreeEntry) Entries() int
func (*CacheTreeEntry) Subtrees ¶
func (e *CacheTreeEntry) Subtrees() int
type ExtensionHeader ¶
type ExtensionHeader struct {
Signature IndexSignature
// Size of the entries data in bytes.
Size uint32
}
type FetchedRef ¶
type Index ¶
type Index struct {
Header IndexHeader `json:"header"`
IndexEntries []IndexEntry `json:"entries"`
CacheTreeEntries []*CacheTreeEntry `json:"trees"`
CacheTreeSize uint32
}
func (*Index) AddEntry ¶
func (index *Index) AddEntry(name string, data IndexEntryData)
func (*Index) CreateCacheTreeEntry ¶
func (index *Index) CreateCacheTreeEntry(path string, sha1 [Sha1Len]byte) *CacheTreeEntry
Create a cache tree entry and add to the index
func (*Index) NumEntries ¶
func (*Index) UpdateTree ¶
func (index *Index) UpdateTree(cacheTreeEntry *CacheTreeEntry, numEntries, numSubtrees int)
type IndexEntry ¶
type IndexEntry struct {
IndexEntryData
Name string `json:"name"`
Padding int
}
type IndexEntryData ¶
type IndexEntryData struct {
CtimeSeconds uint32 `json:"ctime_secs"`
CtimeMillis uint32 `json:"ctime_ms"`
MtimeSeconds uint32 `json:"mtime_secs"`
MtimeMillis uint32 `json:"mtime_ms"`
Dev uint32 `json:"dev"`
Ino uint32 `json:"ino"`
Mode uint32 `json:"mode"`
Uid uint32 `json:"uid"`
Gid uint32 `json:"gid"`
FileSize uint32 `json:"filesize"`
SHA1 IndexSha1 `json:"sha1"`
Flags uint16 `json:"flags"`
}
type IndexHeader ¶
type IndexHeader struct {
Signature IndexSignature `json:"signature"`
Version uint32 `json:"version"`
EntriesCount uint32 `json:"entry_count"`
}
type IndexSha1 ¶
func (*IndexSha1) MarshalJSON ¶
type IndexSignature ¶
type IndexSignature [4]byte
func (*IndexSignature) MarshalJSON ¶
func (i *IndexSignature) MarshalJSON() ([]byte, error)
func (*IndexSignature) String ¶
func (i *IndexSignature) String() string
type ObjectTypeName ¶
type ObjectTypeName struct {
ObjType plumbing.ObjectType
Name entities.Hash
}
type ObjectTypeNameStreamItem ¶
type ObjectTypeNameStreamItem struct {
*ObjectTypeName
Err error
}
type RevListObjects ¶
RevListObjects just clarifies blobs vs. objects slices
type ShellGit ¶
type ShellGit struct {
BinPath string
}
func NewShellGit ¶
func (*ShellGit) AddFetchRefSpec ¶
AddFetchRefSpec is useful to use with negative refspecs since go-git doesn't support them. https://github.com/go-git/go-git/issues/538.
func (*ShellGit) AddRemote ¶
AddRemote is here because go-git doesn't support negative refspecs and will fail to add a remote if the config already contains them.
func (*ShellGit) AllCommitsDates ¶
func (*ShellGit) AllObjects ¶
func (*ShellGit) CheckoutNewBranch ¶
func (*ShellGit) CommitTreeHashes ¶
func (*ShellGit) CommitsFileObjects ¶
func (*ShellGit) CurrentBranch ¶
func (*ShellGit) Fetch ¶
Fetch shells out to `git fetch` because it can be significantly faster than go-git's Fetch for large network downloads.
func (*ShellGit) FetchAndGetUpdatedRefs ¶
func (s *ShellGit) FetchAndGetUpdatedRefs(repoPath string) ([]*FetchedRef, error)
FetchAndGetUpdatedRefs returns the refs that were updated by parsing `git fetch --porcelain` output
func (*ShellGit) GetAllConfigs ¶
func (*ShellGit) GetObjCount ¶
GetObjCount returns the number of objects reachable from rev but unreachable from the exclude set.
func (*ShellGit) GetRemotes ¶
GetRemotes is useful when a negative refspec is used in a remote. go-git doesn't support negative refspecs so it fails to parse remotes using them.
func (*ShellGit) GitCloneBareWithWorktree ¶
func (s *ShellGit) GitCloneBareWithWorktree(ctx context.Context, gitDir, workTree, targetURL, remoteName, ref string) error
GitCloneBareWithWorktree initializes a bare git repository at gitDir configured for workTree, fetches the specified ref from targetURL, and checks out a detached HEAD into workTree.
func (*ShellGit) GitCloneBranchAt ¶
func (*ShellGit) GitCloneCommitAt ¶
GitCloneCommitAt clones a specific commit/tag/branch from a remote repository into the given path.
func (*ShellGit) HasUncommitedChanges ¶
func (*ShellGit) InstallLFSHooks ¶
func (*ShellGit) LFSEnabled ¶
func (*ShellGit) LFSFilesAll ¶
LFS files for the entire history.
func (*ShellGit) ListSymRefs ¶
func (*ShellGit) ListTreeRec ¶
func (*ShellGit) ObjectTypes ¶
func (*ShellGit) ObjectsInTree ¶
func (s *ShellGit) ObjectsInTree(repoPath, ref string) ([]*ObjectTypeName, error)
func (*ShellGit) PackObjects ¶
func (*ShellGit) RebaseOnto ¶
func (*ShellGit) RemoveRemote ¶
func (*ShellGit) RenameRemote ¶
func (*ShellGit) RevListAll ¶
func (*ShellGit) RevListObjects ¶
func (s *ShellGit) RevListObjects(repoPath string, includedCommits, excludedCommits []entities.Hash) (*RevListObjects, error)
RevListObjects utilizes `git rev-list --objects` to find all objects that are descendants of the provided `includedCommits`, but are not descendants of the provided `excludedCommits`. This effectively provides all new objects between commits.
func (*ShellGit) RevListObjectsTopoOrder ¶
func (s *ShellGit) RevListObjectsTopoOrder(repoPath, rev string, excludes []entities.Hash) (<-chan ObjectTypeNameStreamItem, error)
RevListObjectsTopoOrder traverses the object tree from `rev` and provides output with the following characteristics:
- commit objects are output in reverse topological order. Parent commits will be before children commits.
- tree and blob objects immediately following a commit are output in DFS order.
- The output is a partial tree. Tree and blob objects that are present in multiple trees are only shown once, which is at first node traversal in DFS. They will not be shown if they are reachable from an excluded commit.
- It is not guaranteed that observed objects from `cat-file` or `ls-tree` will appear at all expected nodes in the tree.