本文整理匯總了Golang中github.com/driusan/git.Repository.Path方法的典型用法代碼示例。如果您正苦於以下問題:Golang Repository.Path方法的具體用法?Golang Repository.Path怎麽用?Golang Repository.Path使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/driusan/git.Repository
的用法示例。
在下文中一共展示了Repository.Path方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Init
func Init(repo *libgit.Repository, args []string) {
if len(args) > 0 {
if dir := args[len(args)-1]; dir != "init" {
err := os.MkdirAll(dir, 0755)
if err != nil {
panic("Couldn't create directory for initializing git.")
}
err = os.Chdir(dir)
if err != nil {
panic("Couldn't change working directory while initializing git.")
}
if repo != nil {
repo.Path = ".git/"
}
}
}
// These are all the directories created by a clean "git init"
// with the canonical git implementation
os.Mkdir(".git", 0755)
os.MkdirAll(".git/objects/pack", 0755)
os.MkdirAll(".git/objects/info", 0755)
os.MkdirAll(".git/info", 0755) // Should have exclude file in it
os.MkdirAll(".git/hooks", 0755) // should have sample hooks in it.
os.MkdirAll(".git/branches", 0755)
os.MkdirAll(".git/refs/heads", 0755)
os.MkdirAll(".git/refs/tags", 0755)
ioutil.WriteFile(".git/HEAD", []byte("ref: refs/heads/master\n"), 0644)
ioutil.WriteFile(".git/config", []byte("[core]\n\trepositoryformatversion = 0\n\tbare = false\n"), 0644)
ioutil.WriteFile(".git/description", []byte("Unnamed repository; edit this file 'description' to name the repository.\n"), 0644)
}