Skip to content

Commit a62eb0f

Browse files
committed
bug fixed and minor changes
1 parent a3ae540 commit a62eb0f

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

cmd/hook.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var (
1818
CmdHook = cli.Command{
1919
Name: "hook",
2020
Usage: "Delegate commands to corresponding Git hooks",
21-
Description: "All sub-commands should only be called by Git",
21+
Description: "This should only be called by Git",
2222
Flags: []cli.Flag{
2323
cli.StringFlag{
2424
Name: "config, c",

models/migrations/v18.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import (
1313
// ExternalLoginUser makes the connecting between some existing user and additional external login sources
1414
type ExternalLoginUser struct {
1515
ExternalID string `xorm:"NOT NULL"`
16-
UserID int64 `xorm:"NOT NULL"`
17-
LoginSourceID int64 `xorm:"NOT NULL"`
16+
UserID int64 `xorm:"NOT NULL"`
17+
LoginSourceID int64 `xorm:"NOT NULL"`
1818
}
1919

2020
func addExternalLoginUser(x *xorm.Engine) error {

models/repo.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -836,9 +836,9 @@ func createDelegateHooks(repoPath string) (err error) {
836836
var (
837837
hookNames = []string{"pre-receive", "update", "post-receive"}
838838
hookTpls = []string{
839-
"cd ./pre-receive.d\nfor i in `ls`; do\n sh $i\ndone",
840-
"cd ./update.d\nfor i in `ls`; do\n sh $i $1 $2 $3\ndone",
841-
"cd ./post-receive.d\nfor i in `ls`; do\n sh $i\ndone",
839+
fmt.Sprintf("#!/usr/bin/env %s\nORI_DIR=`pwd`\nSHELL_FOLDER=$(cd \"$(dirname \"$0\")\";pwd)\ncd \"$ORI_DIR\"\nfor i in `ls \"$SHELL_FOLDER/pre-receive.d\"`; do\n sh \"$SHELL_FOLDER/pre-receive.d/$i\"\ndone", setting.ScriptType),
840+
fmt.Sprintf("#!/usr/bin/env %s\nORI_DIR=`pwd`\nSHELL_FOLDER=$(cd \"$(dirname \"$0\")\";pwd)\ncd \"$ORI_DIR\"\nfor i in `ls \"$SHELL_FOLDER/update.d\"`; do\n sh \"$SHELL_FOLDER/update.d/$i\" $1 $2 $3\ndone", setting.ScriptType),
841+
fmt.Sprintf("#!/usr/bin/env %s\nORI_DIR=`pwd`\nSHELL_FOLDER=$(cd \"$(dirname \"$0\")\";pwd)\ncd \"$ORI_DIR\"\nfor i in `ls \"$SHELL_FOLDER/post-receive.d\"`; do\n sh \"$SHELL_FOLDER/post-receive.d/$i\"\ndone", setting.ScriptType),
842842
}
843843
giteaHookTpls = []string{
844844
fmt.Sprintf("#!/usr/bin/env %s\n\"%s\" hook --config='%s' pre-receive\n", setting.ScriptType, setting.AppPath, setting.CustomConf),
@@ -2049,7 +2049,7 @@ func SyncRepositoryHooks() error {
20492049
return x.Where("id > 0").Iterate(new(Repository),
20502050
func(idx int, bean interface{}) error {
20512051
if err := createDelegateHooks(bean.(*Repository).RepoPath()); err != nil {
2052-
return err
2052+
return fmt.Errorf("SyncRepositoryHook: %v", err)
20532053
}
20542054
return nil
20552055
})

0 commit comments

Comments
 (0)