Created
August 19, 2020 22:16
-
-
Save ThisIsMissEm/b4b569385806975037da1f37f92fccc1 to your computer and use it in GitHub Desktop.
Patch with test for git pre-push hook when remote is already up to date; No stdin lines are generated
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/t/t5571-pre-push-hook.sh b/t/t5571-pre-push-hook.sh | |
index ac53d63869..edb619726e 100755 | |
--- a/t/t5571-pre-push-hook.sh | |
+++ b/t/t5571-pre-push-hook.sh | |
@@ -19,14 +19,31 @@ test_expect_success 'setup' ' | |
test_commit one && | |
git push parent1 HEAD:foreign | |
' | |
+ | |
+COMMIT1="$(git rev-parse HEAD)" | |
+export COMMIT1 | |
+ | |
+write_script "$HOOK" <<'EOF' | |
+echo "$1" >actual | |
+echo "$2" >>actual | |
+cat >>actual | |
+EOF | |
+ | |
+cat >expected <<EOF | |
+parent1 | |
+repo1 | |
+EOF | |
+ | |
+test_expect_success 'push with no updates' ' | |
+ git push parent1 master:foreign && | |
+ diff expected actual | |
+' | |
+ | |
write_script "$HOOK" <<EOF | |
cat >/dev/null | |
exit 1 | |
EOF | |
-COMMIT1="$(git rev-parse HEAD)" | |
-export COMMIT1 | |
- | |
test_expect_success 'push with failing hook' ' | |
test_commit two && | |
test_must_fail git push parent1 HEAD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment