@ -12,26 +12,34 @@ import (
// PushingEnvironment returns an os environment to allow hooks to work on push
func PushingEnvironment ( doer * User , repo * Repository ) [ ] string {
return FullPushingEnvironment ( doer , doer , repo , 0 )
}
// FullPushingEnvironment returns an os environment to allow hooks to work on push
func FullPushingEnvironment ( author , committer * User , repo * Repository , prID int64 ) [ ] string {
isWiki := "false"
if strings . HasSuffix ( repo . Name , ".wiki" ) {
isWiki = "true"
}
sig := doer . NewGitSig ( )
authorSig := author . NewGitSig ( )
committerSig := committer . NewGitSig ( )
// We should add "SSH_ORIGINAL_COMMAND=gitea-internal",
// once we have hook and pushing infrastructure working correctly
return append ( os . Environ ( ) ,
"GIT_AUTHOR_NAME=" + s ig. Name ,
"GIT_AUTHOR_EMAIL=" + s ig. Email ,
"GIT_COMMITTER_NAME=" + s ig. Name ,
"GIT_COMMITTER_EMAIL=" + s ig. Email ,
"GIT_AUTHOR_NAME=" + authorS ig. Name ,
"GIT_AUTHOR_EMAIL=" + authorS ig. Email ,
"GIT_COMMITTER_NAME=" + committerS ig. Name ,
"GIT_COMMITTER_EMAIL=" + committerS ig. Email ,
EnvRepoName + "=" + repo . Name ,
EnvRepoUsername + "=" + repo . MustOwnerName ( ) ,
EnvRepoIsWiki + "=" + isWiki ,
EnvPusherName + "=" + do er. Name ,
EnvPusherID + "=" + fmt . Sprintf ( "%d" , do er. ID ) ,
EnvPusherName + "=" + committ er. Name ,
EnvPusherID + "=" + fmt . Sprintf ( "%d" , committ er. ID ) ,
ProtectedBranchRepoID + "=" + fmt . Sprintf ( "%d" , repo . ID ) ,
ProtectedBranchPRID + "=" + fmt . Sprintf ( "%d" , prID ) ,
"SSH_ORIGINAL_COMMAND=gitea-internal" ,
)
}