Document receive.denyNonFastforwards
[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>
Johannes Schindelin committed
Sep 21, 2006 at 02:10 UTC
199a92186b6721b23a2400c91f8bd44e7ffa349a
4 files changed
+27
Documentation/config.txt
+7
@@ -267,3 +267,10 @@ whatchanged.difftree::
267
imap::
268
The configuration variables in the 'imap' section are described
269
in gitlink:git-imap-send[1].
270
+
271
+receive.denyNonFastforwads::
272
+ If set to true, git-receive-pack will deny a ref update which is
273
+ not a fast forward. Use this to prevent such an update via a push,
274
+ even if that push is forced. This configuration variable is
275
+ set when initializing a shared repository.
276
+
Documentation/git-init-db.txt
+4
@@ -48,6 +48,10 @@ is given:
48
- 'all' (or 'world' or 'everybody'): Same as 'group', but make the repository
49
readable by all users.
50
51
+By default, the configuration flag receive.denyNonFastforward is enabled
52
+in shared repositories, so that you cannot force a non fast-forwarding push
53
+into it.
54
+
55
--
56
57
Documentation/git-receive-pack.txt
+2
@@ -73,6 +73,8 @@ packed and is served via a dumb transport.
73
There are other real-world examples of using update and
74
post-update hooks found in the Documentation/howto directory.
75
76
+git-receive-pack honours the receive.denyNonFastforwards flag, which
77
+tells it if updates to a ref should be denied if they are not fast-forwards.
78
79
OPTIONS
80
-------
t/t5400-send-pack.sh
+14
@@ -64,4 +64,18 @@ test_expect_success \
64
cmp victim/.git/refs/heads/master .git/refs/heads/master
65
'
66
67
+unset GIT_CONFIG GIT_CONFIG_LOCAL
68
+HOME=`pwd`/no-such-directory
69
+export HOME ;# this way we force the victim/.git/config to be used.
70
+
71
+test_expect_success \
72
+ 'pushing with --force should be denied with denyNonFastforwards' '
73
+ cd victim &&
74
+ git-repo-config receive.denyNonFastforwards true &&
75
+ cd .. &&
76
+ git-update-ref refs/heads/master master^ &&
77
+ git-send-pack --force ./victim/.git/ master &&
78
+ ! diff -u .git/refs/heads/master victim/.git/refs/heads/master
79
+'
80
+
81
test_done