aboutsummaryrefslogtreecommitdiffstats
path: root/models/repo.go
diff options
context:
space:
mode:
authorJohn Olheiser <42128690+jolheiser@users.noreply.github.com>2019-11-30 00:54:47 -0600
committertechknowlogick <techknowlogick@gitea.io>2019-11-30 01:54:47 -0500
commit15a5c10d33fd3c0b9483316b19712e981bf2391d (patch)
tree5eb71ae48739e3f3f0f1e36a5e81b71d3d4e37b0 /models/repo.go
parentc9d50bcab56780fc26ca69cc72197e62bdb02134 (diff)
downloadgitea-15a5c10d33fd3c0b9483316b19712e981bf2391d.tar.gz
gitea-15a5c10d33fd3c0b9483316b19712e981bf2391d.zip
Variable expansion in repository templates (#9163)
* Start expansion Signed-off-by: jolheiser <john.olheiser@gmail.com> * _template rather than .template Signed-off-by: jolheiser <john.olheiser@gmail.com> * Use ioutil Signed-off-by: jolheiser <john.olheiser@gmail.com> * Add descriptions to mapping * Start globbing Signed-off-by: jolheiser <john.olheiser@gmail.com> * Tune globbing Signed-off-by: jolheiser <john.olheiser@gmail.com> * Re-arrange imports Signed-off-by: jolheiser <john.olheiser@gmail.com> * Don't expand git hooks Signed-off-by: jolheiser <john.olheiser@gmail.com> * Add glob tests for .giteatemplate Signed-off-by: jolheiser <john.olheiser@gmail.com> * Parse globs separately so they can be tested more easily Signed-off-by: jolheiser <john.olheiser@gmail.com> * Change template location and add docs Signed-off-by: jolheiser <john.olheiser@gmail.com> * nit Signed-off-by: jolheiser <john.olheiser@gmail.com> * Update docs/content/doc/features/gitea-directory.md Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Update docs/content/doc/features/gitea-directory.md Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Add upper-lower case match Signed-off-by: jolheiser <john.olheiser@gmail.com> * Nits Signed-off-by: jolheiser <john.olheiser@gmail.com> * Update models/repo_generate.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
Diffstat (limited to 'models/repo.go')
-rw-r--r--models/repo.go48
1 files changed, 0 insertions, 48 deletions
diff --git a/models/repo.go b/models/repo.go
index cbe1ccc4f6..0ccf786db3 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -1361,54 +1361,6 @@ func prepareRepoCommit(e Engine, repo *Repository, tmpDir, repoPath string, opts
return nil
}
-func generateRepoCommit(e Engine, repo, templateRepo *Repository, tmpDir string) error {
- commitTimeStr := time.Now().Format(time.RFC3339)
- authorSig := repo.Owner.NewGitSig()
-
- // Because this may call hooks we should pass in the environment
- env := append(os.Environ(),
- "GIT_AUTHOR_NAME="+authorSig.Name,
- "GIT_AUTHOR_EMAIL="+authorSig.Email,
- "GIT_AUTHOR_DATE="+commitTimeStr,
- "GIT_COMMITTER_NAME="+authorSig.Name,
- "GIT_COMMITTER_EMAIL="+authorSig.Email,
- "GIT_COMMITTER_DATE="+commitTimeStr,
- )
-
- // Clone to temporary path and do the init commit.
- templateRepoPath := templateRepo.repoPath(e)
- _, stderr, err := process.GetManager().ExecDirEnv(
- -1, "",
- fmt.Sprintf("generateRepoCommit(git clone): %s", templateRepoPath),
- env,
- git.GitExecutable, "clone", "--depth", "1", templateRepoPath, tmpDir,
- )
- if err != nil {
- return fmt.Errorf("git clone: %v - %s", err, stderr)
- }
-
- if err := os.RemoveAll(path.Join(tmpDir, ".git")); err != nil {
- return fmt.Errorf("remove git dir: %v", err)
- }
-
- if err := git.InitRepository(tmpDir, false); err != nil {
- return err
- }
-
- repoPath := repo.repoPath(e)
- _, stderr, err = process.GetManager().ExecDirEnv(
- -1, tmpDir,
- fmt.Sprintf("generateRepoCommit(git remote add): %s", repoPath),
- env,
- git.GitExecutable, "remote", "add", "origin", repoPath,
- )
- if err != nil {
- return fmt.Errorf("git remote add: %v - %s", err, stderr)
- }
-
- return initRepoCommit(tmpDir, repo.Owner)
-}
-
func checkInitRepository(repoPath string) (err error) {
// Somehow the directory could exist.
if com.IsExist(repoPath) {