mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-20 14:00:04 +02:00
Bug fix
This commit is contained in:
parent
6ca32ef44f
commit
e656609b0d
7 changed files with 75 additions and 19 deletions
|
@ -223,6 +223,17 @@ func initRepository(f string, user *User, repo *Repository, initReadme bool, rep
|
|||
return err
|
||||
}
|
||||
|
||||
// hook/post-update
|
||||
pu, err := os.OpenFile(filepath.Join(repoPath, "hooks", "post-update"), os.O_CREATE|os.O_WRONLY, 0777)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer pu.Close()
|
||||
// TODO: Windows .bat
|
||||
if _, err = pu.WriteString(fmt.Sprintf("#!/usr/bin/env bash\n%s update\n", appPath)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Initialize repository according to user's choice.
|
||||
fileName := map[string]string{}
|
||||
if initReadme {
|
||||
|
@ -275,11 +286,14 @@ func initRepository(f string, user *User, repo *Repository, initReadme bool, rep
|
|||
}
|
||||
}
|
||||
|
||||
if len(fileName) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Apply changes and commit.
|
||||
if err := initRepoCommit(tmpDir, user.NewGitSig()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue