Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] add receive.denyNonFastforwards config variable
Date: Wed, 20 Sep 2006 23:26:05 -0700	[thread overview]
Message-ID: <7vfyeld9c2.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <Pine.LNX.4.63.0609210208350.19042@wbgn013.biozentrum.uni-wuerzburg.de> (Johannes Schindelin's message of "Thu, 21 Sep 2006 02:10:30 +0200 (CEST)")

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh
> index f3694ac..6be3c80 100755
> --- a/t/t5400-send-pack.sh
> +++ b/t/t5400-send-pack.sh
> @@ -64,4 +64,14 @@ test_expect_success \
>  	cmp victim/.git/refs/heads/master .git/refs/heads/master
>  '
>  
> +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

The change shown by "git -SGIT_CONFIG -p t/Makefile" seems to
interfere with this test.  When I run it from shell by hand it
works OK, but when I run it like this:

	cd t && make T=t5400*.sh

it barfs.  s/git-send-pack/strace -f git-send-pack/ seems to
indicate that the receiving end is trying to open .git/config
(rightly, because you told it to do so three months ago ;-)
while its $cwd is victim/.git and fails to read the setting you
are trying to test.  Not good.

I think the change to t/Makefile from 9c3796fc needs to be
rethought.  Most of the tests would be fine with .git/config
(they never step outside t/trash/.git repository), but others
need tweaking, including unsetting it (while unsetting HOME at
the same time perhaps when you do not want to be affected).
Also it may make sense to do the default setting of GIT_CONFIG
in t/test-lib.sh, with a prominent warning why we explicitly
set it to a known value.

In the meantime, I got things working with this patch on top of
your test update.

---

diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh
index 6be3c80..be47ee2 100755
--- a/t/t5400-send-pack.sh
+++ b/t/t5400-send-pack.sh
@@ -64,6 +64,10 @@ 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 &&

  reply	other threads:[~2006-09-21  6:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-20 22:28 [PATCH] add receive.denyNonFastforwards config variable Johannes Schindelin
2006-09-20 22:44 ` Junio C Hamano
2006-09-20 22:46   ` Shawn Pearce
2006-09-20 23:07   ` Johannes Schindelin
2006-09-20 23:19     ` Junio C Hamano
2006-09-21  0:10       ` Johannes Schindelin
2006-09-21  6:26         ` Junio C Hamano [this message]
2006-09-21  9:10           ` Johannes Schindelin
2006-09-20 23:38     ` Junio C Hamano
2006-09-21  0:17       ` Johannes Schindelin
2006-09-21  5:08         ` Junio C Hamano
2006-09-21  5:52         ` Jeff King
2006-09-21  6:43           ` Junio C Hamano
2006-09-21  9:08             ` Johannes Schindelin
2006-09-21  9:25               ` Junio C Hamano
2006-09-20 23:45     ` Jeff King
2006-09-21  0:07       ` Johannes Schindelin
2006-09-21  5:35         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vfyeld9c2.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox