mirror of
https://github.com/thomiceli/opengist
synced 2024-11-08 12:55:50 +01:00
Fix bug on undefined commiter name
This commit is contained in:
parent
746d836b99
commit
5638bf7601
@ -129,7 +129,7 @@ func GetLog(user string, gist string, skip string) ([]*Commit, error) {
|
||||
return parseLog(stdout), nil
|
||||
}
|
||||
|
||||
func CloneTmp(user string, gist string, gistTmpId string) error {
|
||||
func CloneTmp(user string, gist string, gistTmpId string, email string) error {
|
||||
repositoryPath := RepositoryPath(user, gist)
|
||||
|
||||
tmpPath := TmpRepositoriesPath()
|
||||
@ -150,6 +150,18 @@ func CloneTmp(user string, gist string, gistTmpId string) error {
|
||||
// remove every file (and not the .git directory!)
|
||||
cmd = exec.Command("find", ".", "-maxdepth", "1", "-type", "f", "-delete")
|
||||
cmd.Dir = tmpRepositoryPath
|
||||
if err = cmd.Run(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cmd = exec.Command("git", "config", "--local", "user.name", user)
|
||||
cmd.Dir = tmpRepositoryPath
|
||||
if err = cmd.Run(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cmd = exec.Command("git", "config", "--local", "user.email", email)
|
||||
cmd.Dir = tmpRepositoryPath
|
||||
return cmd.Run()
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ func (gist *Gist) NbCommits() (string, error) {
|
||||
}
|
||||
|
||||
func (gist *Gist) AddAndCommitFiles(files *[]FileDTO) error {
|
||||
if err := git.CloneTmp(gist.User.Username, gist.Uuid, gist.Uuid); err != nil {
|
||||
if err := git.CloneTmp(gist.User.Username, gist.Uuid, gist.Uuid, gist.User.Email); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user