diff options
author | 无闻 <joe2010xtmf@163.com> | 2014-04-10 14:38:48 -0400 |
---|---|---|
committer | 无闻 <joe2010xtmf@163.com> | 2014-04-10 14:38:48 -0400 |
commit | 8faa0dbcd77ec17bbf88041f46e2fc48f6ca6f31 (patch) | |
tree | 3dff34e53f34632532fd7a05e00e6f06b3e7fb82 /models/repo.go | |
parent | 2577940c30f6a6d15390974ab36f8c3d1e00f9f4 (diff) | |
parent | a4cbe79567072befd96cf1b7eb319de1e2809ca3 (diff) |
Merge pull request #70 from zhsso/git
Git
Diffstat (limited to 'models/repo.go')
-rw-r--r-- | models/repo.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/models/repo.go b/models/repo.go index bb5c3637..573e0f4e 100644 --- a/models/repo.go +++ b/models/repo.go @@ -79,6 +79,7 @@ type Repository struct { NumOpenIssues int `xorm:"-"` IsPrivate bool IsBare bool + IsGoget bool Created time.Time `xorm:"created"` Updated time.Time `xorm:"updated"` } @@ -261,6 +262,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 +341,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()) |