File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,9 @@ func runHookPreReceive(c *cli.Context) error {
76
76
// the environment setted on serv command
77
77
repoID , _ := strconv .ParseInt (os .Getenv (models .ProtectedBranchRepoID ), 10 , 64 )
78
78
isUncyclo := (os .Getenv (models .EnvRepoIsUncyclo ) == "true" )
79
+ username := os .Getenv (models .EnvRepoUsername )
80
+ reponame := os .Getenv (models .EnvRepoName )
81
+ repoPath := models .RepoPath (username , reponame )
79
82
80
83
buf := bytes .NewBuffer (nil )
81
84
scanner := bufio .NewScanner (os .Stdin )
@@ -113,7 +116,7 @@ func runHookPreReceive(c *cli.Context) error {
113
116
}
114
117
115
118
// Check force push
116
- output , err := git .NewCommand ("rev-list" , oldCommitID , "^" + newCommitID ).Run ( )
119
+ output , err := git .NewCommand ("rev-list" , oldCommitID , "^" + newCommitID ).RunInDir ( repoPath )
117
120
if err != nil {
118
121
fail ("Internal error" , "Fail to detect force push: %v" , err )
119
122
} else if len (output ) > 0 {
You can’t perform that action at this time.
0 commit comments