MCPcopy Create free account
hub / github.com/gogs/gogs / initRepoCommit

Function initRepoCommit

internal/database/repo.go:944–965  ·  view source on GitHub ↗

initRepoCommit temporarily changes with work directory.

(tmpPath string, sig *git.Signature)

Source from the content-addressed store, hash-verified

942
943// initRepoCommit temporarily changes with work directory.
944func initRepoCommit(tmpPath string, sig *git.Signature) (err error) {
945 var stderr string
946 if _, stderr, err = process.ExecDir(-1,
947 tmpPath, fmt.Sprintf("initRepoCommit (git add): %s", tmpPath),
948 "git", "add", "--all"); err != nil {
949 return errors.Newf("git add: %s", stderr)
950 }
951
952 if _, stderr, err = process.ExecDir(-1,
953 tmpPath, fmt.Sprintf("initRepoCommit (git commit): %s", tmpPath),
954 "git", "commit", fmt.Sprintf("--author='%s <%s>'", sig.Name, sig.Email),
955 "-m", "Initial commit"); err != nil {
956 return errors.Newf("git commit: %s", stderr)
957 }
958
959 if _, stderr, err = process.ExecDir(-1,
960 tmpPath, fmt.Sprintf("initRepoCommit (git push): %s", tmpPath),
961 "git", "push"); err != nil {
962 return errors.Newf("git push: %s", stderr)
963 }
964 return nil
965}
966
967type CreateRepoOptionsLegacy struct {
968 Name string

Callers 1

initRepositoryFunction · 0.85

Calls 1

ExecDirFunction · 0.92

Tested by

no test coverage detected