* denyNonFastForwards & co fail outside refs/<heads,tags>
@ 2011-03-29 11:54 Hallvard B Furuseth
2011-03-29 23:59 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Hallvard B Furuseth @ 2011-03-29 11:54 UTC (permalink / raw)
To: git
config options receive.<denyNonFastForward, denyDeletes> do not work in
nonstandard ref namespaces. I stumbled over it in refs/notes/, but the
problem is general. Or if it this intentional, it is the git-config(1)
doc of these options which needs fixing.
Git version 1.7.4.2.
To reproduce:
########################################################################
#!/bin/sh
rm -rf hi ho
git --version
# Create initial repos
git init -q hi
(cd hi
git config receive.denyDeletes true
git config receive.denyNonFastForwards true
echo foo > foo && git add foo && git commit -q -m first foo)
git clone -q hi ho
# Make them diverge, except the checked-out branch
for r in hi ho; do
(cd $r
echo $r >> foo && git commit -q -m next foo
git update-ref refs/outside/test HEAD
git checkout -q -b br HEAD^
# Shut up a bit
git config advice.pushNonFastForward false
git gc --quiet
# For ssh push
git update-server-info)
done
cd ho
# Optional; makes no difference
#git config remote.origin.pushurl localhost:`pwd`/../hi
# Can push test despite 'deny's, fails as expeceted for master:
for b in refs/outside/test refs/heads/master; do
git push -f origin $b:$b
git push -f origin :$b
echo ""
done
# Just to check: Pushing the master normal way fails the same way.
git push -f origin
########################################################################
Output:
git version 1.7.4.2
To /tmp/hi
+ 1bb5836...5bf63f8 refs/outside/test -> refs/outside/test (forced update)
To /tmp/hi
- [deleted] refs/outside/test
remote: error: denying non-fast-forward refs/heads/master (you should pull first)
To /tmp/hi
! [remote rejected] master -> master (non-fast-forward)
error: failed to push some refs to '/tmp/hi'
remote: error: denying ref deletion for refs/heads/master
To /tmp/hi
! [remote rejected] master (deletion prohibited)
error: failed to push some refs to '/tmp/hi'
remote: error: denying non-fast-forward refs/heads/master (you should pull first)
To /tmp/hi
! [remote rejected] master -> master (non-fast-forward)
error: failed to push some refs to '/tmp/hi'
--
Hallvard
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: denyNonFastForwards & co fail outside refs/<heads,tags>
2011-03-29 11:54 denyNonFastForwards & co fail outside refs/<heads,tags> Hallvard B Furuseth
@ 2011-03-29 23:59 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2011-03-29 23:59 UTC (permalink / raw)
To: Hallvard B Furuseth; +Cc: git
Hallvard B Furuseth <h.b.furuseth@usit.uio.no> writes:
> config options receive.<denyNonFastForward, denyDeletes> do not work in
> nonstandard ref namespaces. I stumbled over it in refs/notes/, but the
> problem is general. Or if it this intentional, it is the git-config(1)
> doc of these options which needs fixing.
I think it is very deliberate that denyNonFastForward does not check
anything outside local branch namespace, because there may not even be
ancestry relationship between the object a tag currently points at and the
new object the tag is trying to update (think: a tag can point at a tree
or a blob) and more importantly because pushing into refs/remotes/origin/*
namespace (which is the right way to simulate a "git fetch" from the
repository with a "git push" from outside into the repository in a
firewalled environment where you cannot initiate a connection in one
direction) should be allowed (just like "remote.*.fetch" line in
.git/config get a leading plus sign '+' by default).
I suspect that the restriction on deny_deletes was inherited by a mindless
cut & paste from the deny_non_fast_forwards codepath; I don't think of a
sane rationale to justify the limitation offhand, other than "it has been
wide open since November of 2008 and people may now be relying on that".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-03-29 23:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-29 11:54 denyNonFastForwards & co fail outside refs/<heads,tags> Hallvard B Furuseth
2011-03-29 23:59 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).