mirror of
https://github.com/thomiceli/opengist.git
synced 2025-07-09 01:18:04 +02:00
Add avatars to HTML
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package git
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"opengist/internal/config"
|
||||
"os"
|
||||
@ -114,7 +115,7 @@ func GetLog(user string, gist string, skip string) ([]*Commit, error) {
|
||||
"-p",
|
||||
"--skip",
|
||||
skip,
|
||||
"--format=format:c %H%na %aN%nt %at",
|
||||
"--format=format:c %H%na %aN%nm %ae%nt %at",
|
||||
"--shortstat",
|
||||
"HEAD",
|
||||
)
|
||||
@ -146,12 +147,6 @@ func CloneTmp(user string, gist string, gistTmpId string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
cmd = exec.Command("git", "config", "user.name", user)
|
||||
cmd.Dir = tmpRepositoryPath
|
||||
if err = cmd.Run(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// remove every file (and not the .git directory!)
|
||||
cmd = exec.Command("find", ".", "-maxdepth", "1", "-type", "f", "-delete")
|
||||
cmd.Dir = tmpRepositoryPath
|
||||
@ -167,13 +162,6 @@ func ForkClone(userSrc string, gistSrc string, userDst string, gistDst string) e
|
||||
return err
|
||||
}
|
||||
|
||||
cmd = exec.Command("git", "config", "user.name", userDst)
|
||||
cmd.Dir = repositoryPathDst
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return copyFiles(repositoryPathDst)
|
||||
}
|
||||
|
||||
@ -200,8 +188,15 @@ func AddAll(gistTmpId string) error {
|
||||
return cmd.Run()
|
||||
}
|
||||
|
||||
func CommitRepository(gistTmpId string) error {
|
||||
cmd := exec.Command("git", "commit", "--allow-empty", "-m", `"Opengist commit"`)
|
||||
func CommitRepository(gistTmpId string, authorName string, authorEmail string) error {
|
||||
cmd := exec.Command("git",
|
||||
"commit",
|
||||
"--allow-empty",
|
||||
"-m",
|
||||
"Opengist commit",
|
||||
"--author",
|
||||
fmt.Sprintf("%s <%s>", authorName, authorEmail),
|
||||
)
|
||||
tmpPath := TmpRepositoryPath(gistTmpId)
|
||||
cmd.Dir = tmpPath
|
||||
|
||||
|
@ -26,11 +26,12 @@ type CsvFile struct {
|
||||
}
|
||||
|
||||
type Commit struct {
|
||||
Hash string
|
||||
Author string
|
||||
Timestamp string
|
||||
Changed string
|
||||
Files []File
|
||||
Hash string
|
||||
AuthorName string
|
||||
AuthorEmail string
|
||||
Timestamp string
|
||||
Changed string
|
||||
Files []File
|
||||
}
|
||||
|
||||
func truncateCommandOutput(out io.Reader, maxBytes int64) (string, bool, error) {
|
||||
@ -75,7 +76,10 @@ func parseLog(out io.Reader) []*Commit {
|
||||
currentCommit = &Commit{Hash: string(scanner.Bytes()[2:]), Files: []File{}}
|
||||
|
||||
scanner.Scan()
|
||||
currentCommit.Author = string(scanner.Bytes()[2:])
|
||||
currentCommit.AuthorName = string(scanner.Bytes()[2:])
|
||||
|
||||
scanner.Scan()
|
||||
currentCommit.AuthorEmail = string(scanner.Bytes()[2:])
|
||||
|
||||
scanner.Scan()
|
||||
currentCommit.Timestamp = string(scanner.Bytes()[2:])
|
||||
|
Reference in New Issue
Block a user