Skip to content

Commit

Permalink
Document receive.denyNonFastforwards
Browse files Browse the repository at this point in the history
[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>
  • Loading branch information
Johannes Schindelin authored and Junio C Hamano committed Sep 21, 2006
1 parent 9edd7e4 commit 199a921
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Documentation/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,10 @@ whatchanged.difftree::
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.

4 changes: 4 additions & 0 deletions Documentation/git-init-db.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ is given:
- '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.

--


Expand Down
2 changes: 2 additions & 0 deletions Documentation/git-receive-pack.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ packed and is served via a dumb transport.
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
-------
Expand Down
14 changes: 14 additions & 0 deletions t/t5400-send-pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,18 @@ test_expect_success \
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

0 comments on commit 199a921

Please sign in to comment.