Fix #66
This commit is contained in:
parent
7776f407b6
commit
22feddf804
2 changed files with 17 additions and 11 deletions
|
@ -138,11 +138,8 @@ func CreateRepository(user *User, repoName, desc, repoLang, license string, priv
|
|||
IsPrivate: private,
|
||||
IsBare: repoLang == "" && license == "" && !initReadme,
|
||||
}
|
||||
|
||||
repoPath := RepoPath(user.Name, repoName)
|
||||
if err = initRepository(repoPath, user, repo, initReadme, repoLang, license); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
sess := orm.NewSession()
|
||||
defer sess.Close()
|
||||
sess.Begin()
|
||||
|
@ -207,6 +204,10 @@ func CreateRepository(user *User, repoName, desc, repoLang, license string, priv
|
|||
log.Error("repo.CreateRepository(WatchRepo): %v", err)
|
||||
}
|
||||
|
||||
if err = initRepository(repoPath, user, repo, initReadme, repoLang, license); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return repo, nil
|
||||
}
|
||||
|
||||
|
@ -332,6 +333,11 @@ 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)
|
||||
|
||||
// Apply changes and commit.
|
||||
return initRepoCommit(tmpDir, user.NewGitSig())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue