Fixed GIT_DIR for git hooks that don't have it

This commit is contained in:
Talia 2021-09-14 10:50:36 +02:00
parent c580a5d27c
commit 7245177157
11 changed files with 45 additions and 1 deletions

View file

@ -1,8 +1,11 @@
#!/bin/sh #!/bin/sh
hook=$(basename $0) hook=$(basename $0)
if [ -z "$GIT_DIR" ]
then
GIT_DIR=$(git rev-parse --show-toplevel)/.git
fi
if [ -f $GIT_DIR/hooks/$hook ] if [ -f $GIT_DIR/hooks/$hook ]
then then
echo Running project-level hook: $GIT_DIR/hooks/$hook echo Running project-level hook: $GIT_DIR/hooks/$hook
$GIT_DIR/hooks/$hook $GIT_DIR/hooks/$hook
fi fi

View file

@ -1,5 +1,9 @@
#!/bin/sh #!/bin/sh
hook=$(basename $0) hook=$(basename $0)
if [ -z "$GIT_DIR" ]
then
GIT_DIR=$(git rev-parse --show-toplevel)/.git
fi
if [ -f $GIT_DIR/hooks/$hook ] if [ -f $GIT_DIR/hooks/$hook ]
then then
echo Running project-level hook: $GIT_DIR/hooks/$hook echo Running project-level hook: $GIT_DIR/hooks/$hook

View file

@ -1,7 +1,12 @@
#!/bin/sh #!/bin/sh
hook=$(basename $0) hook=$(basename $0)
if [ -z "$GIT_DIR" ]
then
GIT_DIR=$(git rev-parse --show-toplevel)/.git
fi
if [ -f $GIT_DIR/hooks/$hook ] if [ -f $GIT_DIR/hooks/$hook ]
then then
echo Running project-level hook: $GIT_DIR/hooks/$hook echo Running project-level hook: $GIT_DIR/hooks/$hook
$GIT_DIR/hooks/$hook $GIT_DIR/hooks/$hook
fi fi

View file

@ -1,5 +1,9 @@
#!/bin/sh #!/bin/sh
hook=$(basename $0) hook=$(basename $0)
if [ -z "$GIT_DIR" ]
then
GIT_DIR=$(git rev-parse --show-toplevel)/.git
fi
if [ -f $GIT_DIR/hooks/$hook ] if [ -f $GIT_DIR/hooks/$hook ]
then then
echo Running project-level hook: $GIT_DIR/hooks/$hook echo Running project-level hook: $GIT_DIR/hooks/$hook

View file

@ -1,5 +1,9 @@
#!/bin/sh #!/bin/sh
hook=$(basename $0) hook=$(basename $0)
if [ -z "$GIT_DIR" ]
then
GIT_DIR=$(git rev-parse --show-toplevel)/.git
fi
if [ -f $GIT_DIR/hooks/$hook ] if [ -f $GIT_DIR/hooks/$hook ]
then then
echo Running project-level hook: $GIT_DIR/hooks/$hook echo Running project-level hook: $GIT_DIR/hooks/$hook

View file

@ -1,5 +1,9 @@
#!/bin/sh #!/bin/sh
hook=$(basename $0) hook=$(basename $0)
if [ -z "$GIT_DIR" ]
then
GIT_DIR=$(git rev-parse --show-toplevel)/.git
fi
if [ -f $GIT_DIR/hooks/$hook ] if [ -f $GIT_DIR/hooks/$hook ]
then then
echo Running project-level hook: $GIT_DIR/hooks/$hook echo Running project-level hook: $GIT_DIR/hooks/$hook

View file

@ -1,5 +1,9 @@
#!/bin/sh #!/bin/sh
hook=$(basename $0) hook=$(basename $0)
if [ -z "$GIT_DIR" ]
then
GIT_DIR=$(git rev-parse --show-toplevel)/.git
fi
if [ -f $GIT_DIR/hooks/$hook ] if [ -f $GIT_DIR/hooks/$hook ]
then then
echo Running project-level hook: $GIT_DIR/hooks/$hook echo Running project-level hook: $GIT_DIR/hooks/$hook

View file

@ -1,5 +1,9 @@
#!/bin/sh #!/bin/sh
hook=$(basename $0) hook=$(basename $0)
if [ -z "$GIT_DIR" ]
then
GIT_DIR=$(git rev-parse --show-toplevel)/.git
fi
if [ -f $GIT_DIR/hooks/$hook ] if [ -f $GIT_DIR/hooks/$hook ]
then then
echo Running project-level hook: $GIT_DIR/hooks/$hook echo Running project-level hook: $GIT_DIR/hooks/$hook

View file

@ -1,5 +1,9 @@
#!/bin/sh #!/bin/sh
hook=$(basename $0) hook=$(basename $0)
if [ -z "$GIT_DIR" ]
then
GIT_DIR=$(git rev-parse --show-toplevel)/.git
fi
if [ -f $GIT_DIR/hooks/$hook ] if [ -f $GIT_DIR/hooks/$hook ]
then then
echo Running project-level hook: $GIT_DIR/hooks/$hook echo Running project-level hook: $GIT_DIR/hooks/$hook

View file

@ -1,5 +1,9 @@
#!/bin/sh #!/bin/sh
hook=$(basename $0) hook=$(basename $0)
if [ -z "$GIT_DIR" ]
then
GIT_DIR=$(git rev-parse --show-toplevel)/.git
fi
if [ -f $GIT_DIR/hooks/$hook ] if [ -f $GIT_DIR/hooks/$hook ]
then then
echo Running project-level hook: $GIT_DIR/hooks/$hook echo Running project-level hook: $GIT_DIR/hooks/$hook

View file

@ -1,5 +1,9 @@
#!/bin/sh #!/bin/sh
hook=$(basename $0) hook=$(basename $0)
if [ -z "$GIT_DIR" ]
then
GIT_DIR=$(git rev-parse --show-toplevel)/.git
fi
if [ -f $GIT_DIR/hooks/$hook ] if [ -f $GIT_DIR/hooks/$hook ]
then then
echo Running project-level hook: $GIT_DIR/hooks/$hook echo Running project-level hook: $GIT_DIR/hooks/$hook