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

skip checks for branch deletions #73

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pre-receive
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ case $(puppet --version) in
esac

while read -r oldrev newrev refname; do

# workaround: deleting a branch should skip the checks
if [[ $newrev == "0000000000000000000000000000000000000000" ]]; then
echo "Skipping file checks this is a branch delete..."
rm -rf "$tmptree"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brianlong2 It would be much safer to use rmdir instead of rm. With this we avoid problems mentioned by David in comment.

exit 0
fi

git archive "$newrev" | tar x -C "$tmptree"

# for a new branch oldrev is 0{40}, set newrev to branch name and oldrev to parent branch
Expand Down