diff options
author | Unknown <joe2010xtmf@163.com> | 2014-04-08 12:41:33 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-04-08 12:41:33 -0400 |
commit | 115a349131242201953a3f5693141679049355c6 (patch) | |
tree | 5509a46e5d6866cd573c03a41484d58c12cb6cae /models/repo.go | |
parent | 22feddf804c7fbf3418cbbc8e7302da271da4e5a (diff) | |
download | gitea-115a349131242201953a3f5693141679049355c6.tar.gz gitea-115a349131242201953a3f5693141679049355c6.zip |
Fix #67
Diffstat (limited to 'models/repo.go')
-rw-r--r-- | models/repo.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/models/repo.go b/models/repo.go index bb5c36372e..4f58f407fa 100644 --- a/models/repo.go +++ b/models/repo.go @@ -261,6 +261,13 @@ func createHookUpdate(hookPath, content string) error { return err } +// SetRepoEnvs sets environment variables for command update. +func SetRepoEnvs(userId int64, userName, repoName string) { + os.Setenv("userId", base.ToStr(userId)) + os.Setenv("userName", userName) + os.Setenv("repoName", repoName) +} + // InitRepository initializes README and .gitignore if needed. func initRepository(f string, user *User, repo *Repository, initReadme bool, repoLang, license string) error { repoPath := RepoPath(user.Name, repo.Name) @@ -333,10 +340,7 @@ func initRepository(f string, user *User, repo *Repository, initReadme bool, rep return nil } - // for update use - os.Setenv("userName", user.Name) - os.Setenv("userId", base.ToStr(user.Id)) - os.Setenv("repoName", repo.Name) + SetRepoEnvs(user.Id, user.Name, repo.Name) // Apply changes and commit. return initRepoCommit(tmpDir, user.NewGitSig()) |