summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9edd7e4)
raw | patch | inline | side by side (parent: 9edd7e4)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Thu, 21 Sep 2006 00:10:30 +0000 (02:10 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 21 Sep 2006 06:32:22 +0000 (23:32 -0700) |
[jc: with a fix to config handling in t5400 test, which took
annoyingly long to diagnose.]
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
annoyingly long to diagnose.]
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
index 844cae4cf024b17206021d1c55819922cf99277d..bb2fbc324e6fa93a639b31668a7a030ece7787f0 100644 (file)
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
imap::
The configuration variables in the 'imap' section are described
in gitlink:git-imap-send[1].
+
+receive.denyNonFastforwads::
+ If set to true, git-receive-pack will deny a ref update which is
+ not a fast forward. Use this to prevent such an update via a push,
+ even if that push is forced. This configuration variable is
+ set when initializing a shared repository.
+
index 63cd5dab3f82746816d6dc0b8eae32f2c9d930d4..ca7d09dc0a8563a1d8005bc83a89d19c785c1a3d 100644 (file)
- 'all' (or 'world' or 'everybody'): Same as 'group', but make the repository
readable by all users.
+By default, the configuration flag receive.denyNonFastforward is enabled
+in shared repositories, so that you cannot force a non fast-forwarding push
+into it.
+
--
index f9457d45ed684597769124af945c184a7d03a948..0dfadc2a32a44ef1e026ae95c8cc5906ec4d4d5c 100644 (file)
There are other real-world examples of using update and
post-update hooks found in the Documentation/howto directory.
+git-receive-pack honours the receive.denyNonFastforwards flag, which
+tells it if updates to a ref should be denied if they are not fast-forwards.
OPTIONS
-------
diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh
index f3694ac3c78e64b6b77ebfef4cb3e90f9fb6c32c..8afb89971752fe4a91b9b7c62b4b0a6b69a8272b 100755 (executable)
--- a/t/t5400-send-pack.sh
+++ b/t/t5400-send-pack.sh
cmp victim/.git/refs/heads/master .git/refs/heads/master
'
+unset GIT_CONFIG GIT_CONFIG_LOCAL
+HOME=`pwd`/no-such-directory
+export HOME ;# this way we force the victim/.git/config to be used.
+
+test_expect_success \
+ 'pushing with --force should be denied with denyNonFastforwards' '
+ cd victim &&
+ git-repo-config receive.denyNonFastforwards true &&
+ cd .. &&
+ git-update-ref refs/heads/master master^ &&
+ git-send-pack --force ./victim/.git/ master &&
+ ! diff -u .git/refs/heads/master victim/.git/refs/heads/master
+'
+
test_done