Skip to content
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

No information is given on stdin for pre/post-receive #1957

Closed
2 of 7 tasks
UziTech opened this issue Jun 12, 2017 · 4 comments
Closed
2 of 7 tasks

No information is given on stdin for pre/post-receive #1957

UziTech opened this issue Jun 12, 2017 · 4 comments
Labels
type/question Issue needs no code to be fixed, only a description on how to fix it yourself.

Comments

@UziTech
Copy link

UziTech commented Jun 12, 2017

  • Gitea version (or commit ref): 1.1.1
  • Git version: 2.13.0.windows.1
  • Operating system: Windows Server 2012 R2
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

pre-receive and post-receive git hooks are supposed to receive information on stdin

related #1808

@lunny lunny added the type/question Issue needs no code to be fixed, only a description on how to fix it yourself. label Jun 13, 2017
@olivier-mauras
Copy link

I've noted the same issue when I migrated from my 0.9 Gogs install to Gitea.
This comes from the new post-receive wrapper script in hooks/post-receive

#!/usr/bin/env bash
ORI_DIR=`pwd`
SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
cd "$ORI_DIR"
for i in `ls "$SHELL_FOLDER/post-receive.d"`; do
    sh "$SHELL_FOLDER/post-receive.d/$i"
done

Your actual hook is in hooks/post-receive.d/post-receive
This indeed doesn't forward stdin to post-receive.d/ scripts.

Something like that would make your pre/post-receive work again:

#!/usr/bin/env bash
ORI_DIR=`pwd`
SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
read STDIN
cd "$ORI_DIR"
for i in `ls "$SHELL_FOLDER/post-receive.d"`; do
    echo "$STDIN" | sh "$SHELL_FOLDER/post-receive.d/$i"
done

I'll see if I can make a PR for that.

@lunny
Copy link
Member

lunny commented Jun 15, 2017

We need also some integration tests about hooks.

@lafriks
Copy link
Member

lafriks commented Jul 1, 2017

This issue is fixed in master with #1257 and duplicate of #1250

@lafriks lafriks closed this as completed Jul 1, 2017
@lafriks
Copy link
Member

lafriks commented Jul 1, 2017

Also #1257 was backported to 1.1.x version but not migration. You should manually run Resync pre-receive, update and post-receive hooks of all repositories. from administrator dashboard to have correct hooks

@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/question Issue needs no code to be fixed, only a description on how to fix it yourself.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants