remote rename: demonstrate a bogus "remote exists" bug

Some users like to set `remote.origin.prune = true` in their ~/.gitconfig so that all of their repositories use that default. However, our code is ill-prepared for this, mistaking that single entry to mean that there is already a remote of the name "origin", even if there is not. This patch adds a test case demonstrating this issue. Reported by Andrew Arnott. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Jan 19, 2017 at 22:19 UTC af5bacf471825662f8eeda932cfabd6c47634434
1 file changed +7
t/t5505-remote.sh
+7
@@ -764,6 +764,13 @@ test_expect_success 'rename a remote with name prefix of other remote' '
764 )
765 '
766
767 +test_expect_failure 'rename succeeds with existing remote.<target>.prune' '
768 + git clone one four.four &&
769 + test_when_finished git config --global --unset remote.upstream.prune &&
770 + git config --global remote.upstream.prune true &&
771 + git -C four.four remote rename origin upstream
772 +'
773 +
774 cat >remotes_origin <<EOF
775 URL: $(pwd)/one
776 Push: refs/heads/master:refs/heads/upstream