kmgGit

package
v0.0.0-...-05317bf Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2015 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GitTestCb

func GitTestCb(f func())

func MustGitClone

func MustGitClone(url string, path string)

func MustIsRepositoryAtPath

func MustIsRepositoryAtPath(path string) bool

Types

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

func DefaultRepository

func DefaultRepository() (repo *Repository)

func GetRepositoryFromPath

func GetRepositoryFromPath(path string) (repo *Repository, err error)

func MustGetRepositoryFromPath

func MustGetRepositoryFromPath(path string) (repo *Repository)

func (*Repository) GetGitPath

func (repo *Repository) GetGitPath() string

func (*Repository) MustFakeSubmoduleAdd

func (repo *Repository) MustFakeSubmoduleAdd(path string) bool

这个函数返回 经过处理后该路径是否是一个伪submodule 请调用者保证这个path里面有.git文件夹

func (*Repository) MustFakeSubmoduleCommit

func (repo *Repository) MustFakeSubmoduleCommit()

把当前项目里面的所有的子项目都变成伪submodule,并且保存版本信息到.gitFakeSubmodule 中

func (*Repository) MustFakeSubmoduleUpdate

func (repo *Repository) MustFakeSubmoduleUpdate()

从 .gitFakeSubmodule 中还原旧的fakeSubmoudle,并且将所有子项目都切换到该文件里面写的分支(使用reset切分支,保证不掉数据)

func (*Repository) MustGetAllParentCommitId

func (repo *Repository) MustGetAllParentCommitId(commitId string) []string

这个返回自己这个commit的名称,也返回所有父级commit的名称

func (*Repository) MustGetCurrentBranchName

func (repo *Repository) MustGetCurrentBranchName() string

func (*Repository) MustGetHeadCommitId

func (repo *Repository) MustGetHeadCommitId() string

func (*Repository) MustGetIndexFileList

func (repo *Repository) MustGetIndexFileList() []string

func (*Repository) MustGetRemoteUrl

func (repo *Repository) MustGetRemoteUrl(branch string) string

func (*Repository) MustHasFilesInDirInIndex

func (repo *Repository) MustHasFilesInDirInIndex(path string) bool

返回index里面某个文件路径下面是否有文件,如果它本身在index里面返回false

func (*Repository) MustIndexAddFile

func (repo *Repository) MustIndexAddFile(path string)

func (*Repository) MustIndexRemoveByPath

func (repo *Repository) MustIndexRemoveByPath(path string)

func (*Repository) MustIsFileIgnore

func (repo *Repository) MustIsFileIgnore(path string) bool

func (*Repository) MustIsFileInIndex

func (repo *Repository) MustIsFileInIndex(path string) bool

是否这个路径指向的东西在index里面存在(确切的文件)

func (*Repository) MustIsInParent

func (repo *Repository) MustIsInParent(commitId string, parentCommitId string) bool

func (*Repository) MustResetToCommitId

func (repo *Repository) MustResetToCommitId(commitId string)

func (*Repository) MustSetRemoteUrl

func (repo *Repository) MustSetRemoteUrl(branch string, url string)

func (*Repository) MustSmallestChange

func (repo *Repository) MustSmallestChange(localCommit string, targetCommit string) string

// 返回最小变化的提交的名字 // 找到当前文件和commitId里面变化最小的版本 // localCommit 是当前文件的提交 // targetCommit 是需要寻找最小版本的commit

无.git文件恢复
git clone xxx ./tmp1
mv ./tmp1/.git ./
git checkout --orphan current
kmg GitSmallestChange -local=current -target=master
git checkout xx //返回的那个分支地址

type SubRepositoryInfo

type SubRepositoryInfo struct {
	RemoteUrl string
	CommitId  string
}

Jump to

Keyboard shortcuts

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