本文整理汇总了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)
}