-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #1957 - Fix forwarding stdin to pre/post-receive scripts #1975
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be as new migration step as otherwise scripts won't be updated for anyone using 1.1+ version
Oh now I have to get a grasp of those migration steps ^^ |
And maybe some integration test? There are many examples in |
@@ -31,9 +31,9 @@ func generateAndMigrateWikiGitHooks(x *xorm.Engine) (err error) { | |||
var ( | |||
hookNames = []string{"pre-receive", "update", "post-receive"} | |||
hookTpls = []string{ | |||
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), | |||
fmt.Sprintf("#!/usr/bin/env %s\nORI_DIR=`pwd`\nSHELL_FOLDER=$(cd \"$(dirname \"$0\")\";pwd)\nread STDIN\ncd \"$ORI_DIR\"\nfor i in `ls \"$SHELL_FOLDER/pre-receive.d\"`; do\n echo \"$STDIN\" | sh \"$SHELL_FOLDER/pre-receive.d/$i\"\ndone", setting.ScriptType), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this need a new migration since this has already been ran...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree for already migrated instances, but not on instances still on gogs that will migrate to gitea...
Or you mean that it's pointless anyway cause it needs its own migration step anyway that will happen in both cases ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For instances migrating from Gogs, they will have to go through all migrations. The latest migration to touch a file "wins" 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood. I'll remove the modification from there and add it in its own migration step then.
This issue is actually already resolved in commit fe94032 and this PR just fixes older migrations that will be overridden by migration v26 anyway |
Fix #1957
Ensure stdin is forwarded for pre/post-receive hooks