[Slackbuilds-users] Question about git workflow

Willy Sudiarto Raharjo willysr at slackbuilds.org
Mon Mar 6 06:36:21 UTC 2017


>> We only support git. cgit is just web interface so can see other's work
> 
> I upload my SlackBuilds to GitHub
> (https://github.com/drgibbon/slackbuilds), is there any way for that to
> be incorporated into the workflow? I find making a tar archive/uploading
> to the website to be quite unwieldy when I want to update a script
> (although I'm doing quite low maintenance stuff, but still).

it's better to fork from https://github.com/SlackBuildsOrg/slackbuilds/
and then create your own branch and start making changes

Some notes:
- always rebase from latest master branch
- Only 1 commit per script
- Use the following commit message template for version bump
"<category>/<script>: Updated for version <version>"
- place the following git hooks in slackbuilds/.git/hooks to keep the
permission and make sure your commit message doesn't exceed 68 chars.

you can send the URL of your branch to us and we can review them

-- 
Willy Sudiarto Raharjo
-------------- next part --------------
#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by git-commit with one argument, the name of the file
# that has the commit message.  The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit.  The hook is allowed to edit the commit message file.
#
# To enable this hook, rename this file to "commit-msg".

# Uncomment the below to add a Signed-off-by line to the message.
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
# hook is more suited to it.
#
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"

# This example catches duplicate Signed-off-by lines.

# test "" = "$(grep '^Signed-off-by: ' "$1" |
# 	 sort | uniq -c | sed -e '/^[ 	]*1[ 	]/d')" || {
# 	echo >&2 Duplicate Signed-off-by lines.
# 	exit 1
# }

msg=$(sed "/^#/d" "$1")

test $(echo "$msg" | wc -L | cut -d " " -f 1) -lt 69 ||
 {
    echo "Line length of commit message exceeded 68 characters!"
    exit 1
 }

if [ "$(echo "$msg" | wc -l | cut -d " " -f 1)" -ge "2" ]; then
  test "$(echo "$msg" | sed -n "2p")" = "" ||
   {
     echo "Line number 2 not empty!"
     exit 1
   }
fi
-------------- next part --------------
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by git-commit with no arguments.  The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".

# if git-rev-parse --verify HEAD >/dev/null 2>&1
# then
# 	against=HEAD
# else
# 	# Initial commit: diff against an empty tree object
# 	against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
# fi
#
# # If you want to allow non-ascii filenames set this variable to true.
# allownonascii=$(git config hooks.allownonascii)
#
# # Cross platform projects tend to avoid non-ascii filenames; prevent
# # them from being added to the repository. We exploit the fact that the
# # printable range starts at the space character and ends with tilde.
# if [ "$allownonascii" != "true" ] &&
# 	# Note that the use of brackets around a tr range is ok here, (it's
# 	# even required, for portability to Solaris 10's /usr/bin/tr), since
# 	# the square bracket bytes happen to fall in the designated range.
# 	test "$(git diff --cached --name-only --diff-filter=A -z $against |
# 	  LC_ALL=C tr -d '[ -~]\0')"
# then
# 	echo "Error: Attempt to add a non-ascii file name."
# 	echo
# 	echo "This can cause problems if you want to work"
# 	echo "with people on other platforms."
# 	echo
# 	echo "To be portable it is advisable to rename the file ..."
# 	echo
# 	echo "If you know what you are doing you can disable this"
# 	echo "check using:"
# 	echo
# 	echo "  git config hooks.allownonascii true"
# 	echo
# 	exit 1
# fi
#
# exec git diff-index --check --cached $against --

ERROR="no"
FILES=$(git diff-index --cached --name-only HEAD)
HAS_INFO=$(git diff-index --cached --name-only HEAD | grep "\.info")

if ! [ -z "$FILES" ]; then
  for i in $FILES; do
    if [ -e $i ]; then
      MODE=$(stat -c "%a" "$i")
      if ! [ $MODE = "644" ]; then
        echo "$i has wrong mode set ($MODE instead of 644)"
        ERROR="yes"
      fi
    fi
  done
fi

if [ "$ERROR" = "yes" ]; then
  echo "Exit"
  exit 1
fi

#exit 1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.slackbuilds.org/pipermail/slackbuilds-users/attachments/20170306/892997a7/attachment-0001.asc>


More information about the SlackBuilds-users mailing list