git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* receive.denyCurrentBranch=updateInstead updates working tree even when receive.denyNonFastForwards rejects push
@ 2018-10-16 18:54 Rajesh Madamanchi
  2018-10-19  0:16 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Rajesh Madamanchi @ 2018-10-16 18:54 UTC (permalink / raw)
  To: git

Hi, I am looking to report the below behavior when seems incorrect to
me when receive.denyCurrentBranch is set to updateInstead and
receive.denyNonFastForwards is set to true. Below are the steps to
reproduce the scenario. Please excuse my ignorance if I'm missing
something fundamental.

Step 1 - Setup remote repository (remote host):
git config --global receive.denyCurrentBranch updateInstead
git config --global receive.denyNonFastForwards true
mkdir /tmp/hello
cd /tmp/hello
git init
echo hello > hello.txt
git add . && git commit -m "hello.txt"

Step 2 - Create 2 Clones (local host):
git clone ssh://REMOTEIP/tmp/hello /tmp/hello1
git clone ssh://REMOTEIP/tmp/hello /tmp/hello2

Step 3 - Push a commit from Clone 1
cd /tmp/hello1
echo hello1 > hello1.txt
git add . && git commit -m "hello1.txt"
git push
--> at this point server working tree contains hello1.txt which is expected

Step 4: Try to force push a commit from Clone 2
cd /tmp/hello2
echo hello2 > hello2.txt
git add . && git commit -m "hello2.txt"
git push
--> Remote rejects with message that remote contains work i do not have locally
git push --force
--> Remote rejects again with error: denying non-fast-forward
refs/heads/master (you should pull first)
--> At this point, since the push is rejected, I expect the servers
working tree to not contain any rejected changes. BUT the servers
working tree got updated to delete hello1.txt and create hello2.txt.
Push rejected but not really.

I also noticed the same behavior (incorrect) when the update hook
rejects changes on the server (but not the pre-receive hook).

Thank you

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-10-22  9:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-16 18:54 receive.denyCurrentBranch=updateInstead updates working tree even when receive.denyNonFastForwards rejects push Rajesh Madamanchi
2018-10-19  0:16 ` Junio C Hamano
2018-10-19  3:37   ` Junio C Hamano
2018-10-19  4:57     ` [PATCH] receive: denyCurrentBranch=updateinstead should not blindly update Junio C Hamano
2018-10-19  5:54       ` Eric Sunshine
2018-10-22  9:32       ` Johannes Schindelin

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).