Pre-push hook must exit with a non-zero result when git-lfs isn't on the path

Otherwise the branch push will go ahead and data will be incomplete on the server
This commit is contained in:
Steve Streeting 2015-08-13 10:15:59 +01:00
parent 3f2a526bf2
commit 3920ef5757
2 changed files with 2 additions and 2 deletions

@ -17,7 +17,7 @@ var (
valueRegexp = regexp.MustCompile("\\Agit[\\-\\s]media") valueRegexp = regexp.MustCompile("\\Agit[\\-\\s]media")
NotInARepositoryError = errors.New("Not in a repository") NotInARepositoryError = errors.New("Not in a repository")
prePushHook = "#!/bin/sh\ncommand -v git-lfs >/dev/null 2>&1 || { echo >&2 \"\\nThis repository has been set up with Git LFS but Git LFS is not installed.\\n\"; exit 0; }\ngit lfs pre-push \"$@\"" prePushHook = "#!/bin/sh\ncommand -v git-lfs >/dev/null 2>&1 || { echo >&2 \"\\nThis repository has been set up with Git LFS but Git LFS is not installed.\\n\"; exit 2; }\ngit lfs pre-push \"$@\""
prePushUpgrades = map[string]bool{ prePushUpgrades = map[string]bool{
"#!/bin/sh\ngit lfs push --stdin $*": true, "#!/bin/sh\ngit lfs push --stdin $*": true,
"#!/bin/sh\ngit lfs push --stdin \"$@\"": true, "#!/bin/sh\ngit lfs push --stdin \"$@\"": true,

@ -7,7 +7,7 @@ begin_test "update"
set -e set -e
pre_push_hook="#!/bin/sh pre_push_hook="#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 \"\\nThis repository has been set up with Git LFS but Git LFS is not installed.\\n\"; exit 0; } command -v git-lfs >/dev/null 2>&1 || { echo >&2 \"\\nThis repository has been set up with Git LFS but Git LFS is not installed.\\n\"; exit 2; }
git lfs pre-push \"\$@\"" git lfs pre-push \"\$@\""
mkdir without-pre-push mkdir without-pre-push