Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Affrae add block_branch_names_not_starting_with_userID.sh - #144

Merged
affrae merged 7 commits into
masterfrom
affrae-add-block_branch_names_not_starting_with_userID.sh
Aug 24, 2017
Merged

Affrae add block_branch_names_not_starting_with_userID.sh#144
affrae merged 7 commits into
masterfrom
affrae-add-block_branch_names_not_starting_with_userID.sh

Conversation

@affrae

@affrae affrae commented Aug 2, 2017

Copy link
Copy Markdown
Contributor

I get asked about branch naming conventions a lot - so I usually show this as a pre-receive hook.

There is one caveat: this comparison is currently case sensitive.

@affrae affrae self-assigned this Aug 2, 2017

@mzzmjd mzzmjd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great Idea 👍
Are lines 30 to 32 necessary?
Someone has entered the correct details, do we need to tell them that they have entered the correct details?

if [[ $oldrev == $zero_commit && $refname =~ ^refs/heads/ ]]; then
# Check if the branch name is lower case characters (ASCII only), '-', '_', "/" or numbers
if [[ ! $refname =~ ^refs/heads/$GITHUB_USER_LOGIN ]]; then
echo "Hi, $GITHUB_USER_LOGIN Blocking creation of new branch $refname"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this line be:

echo "Hi $GITHUB_USER_LOGIN, Blocking creation of new branch $refname"

Move the comma so that the message reads:

Hi affrae, Blocking creation of new branch BRANCH-NAME"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@affrae Forgot to kick off a review of this line?
This is me being pedantic over English grammar. I can remember that English lesson 👨‍🏫 at school 🏫 all be it over 40 years ago. 👴

fi
fi
done
echo "Hi, $GITHUB_USER_LOGIN allowing creation of new branch $refname"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this line be:

echo "Hi $GITHUB_USER_LOGIN, allowing creation of new branch $refname"

Move the comma so that the message reads:

Hi affrae, allowing creation of new branch affraeBRANCH-NAME

@affrae affrae Aug 2, 2017

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@mzzmjd That's a good point - I use this particular message in my demo to show that it does not have to be an error message passed back. I can remove it if you like - just let me know!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's fine. 👍
Anyone that picks up these scripts may make some tweaks to suit their setup.

@affrae

affrae commented Aug 3, 2017

Copy link
Copy Markdown
Contributor Author

@mzzmjd I have chosen to comment out the lines but not remove them - thus they can be added for demo purposes when required, as opposed to by default.

@jonico jonico left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@affrae

affrae commented Aug 24, 2017

Copy link
Copy Markdown
Contributor Author

Thanks, @jonico

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants