add more README vars

This commit is contained in:
Unknwon 2015-08-28 18:36:32 +08:00
parent bb3b90fcd6
commit 11ce720f9f

View file

@ -530,9 +530,15 @@ func prepareRepoCommit(repo *Repository, tmpDir, repoPath string, opts CreateRep
return fmt.Errorf("getRepoInitFile[%s]: %v", opts.Readme, err) return fmt.Errorf("getRepoInitFile[%s]: %v", opts.Readme, err)
} }
cloneLink, err := repo.CloneLink()
if err != nil {
return fmt.Errorf("CloneLink: %v", err)
}
match := map[string]string{ match := map[string]string{
"Name": repo.Name, "Name": repo.Name,
"Description": repo.Description, "Description": repo.Description,
"CloneURL.SSH": cloneLink.SSH,
"CloneURL.HTTPS": cloneLink.HTTPS,
} }
if err = ioutil.WriteFile(filepath.Join(tmpDir, "README.md"), if err = ioutil.WriteFile(filepath.Join(tmpDir, "README.md"),
[]byte(com.Expand(string(data), match)), 0644); err != nil { []byte(com.Expand(string(data), match)), 0644); err != nil {