From patchwork Fri Oct 26 23:07:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 10657961 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2EAE313BF for ; Fri, 26 Oct 2018 23:08:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23F582C9FD for ; Fri, 26 Oct 2018 23:08:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 181192CA63; Fri, 26 Oct 2018 23:08:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97BDF2C9FD for ; Fri, 26 Oct 2018 23:08:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728353AbeJ0Hq5 (ORCPT ); Sat, 27 Oct 2018 03:46:57 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:55513 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727792AbeJ0Hq4 (ORCPT ); Sat, 27 Oct 2018 03:46:56 -0400 Received: by mail-wm1-f66.google.com with SMTP id s10-v6so2881177wmc.5 for ; Fri, 26 Oct 2018 16:07:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iqP4ifgdyK4zyDNdbbZLEqxXMcAsbdFVTcoO9nvJutA=; b=nUqIGU6IOqOCu8Ajkocbe3yT31RnIXGBdFVvy+0TyyTsJBYNn9pXNqKODuYJ2pk50Z i3uV+8+yIY45r8eiNPrCvP/W4YpELXzaPSVowIZXEK/acTd5DE9/MKr6N1KLHPynS6+K GZ39L9x+9RmZkz+y8ozFET7EC0T/bXmVRVRYFoOxTWV59Q9Q9ANK6y666VnQhYYc3x1R Pr8iQ+OAP3u0uWS2MenN04/X0Lx1h7ieocmUa+PADzjaGiMbZr7AXnWMtuBaq41knTQA 4E9mWW7PtmnKpg84zyTXSjpYQk2HiLlClU0nnWCn4kxmePC7YGBCmrYsS7yEsvByQt6Z qo4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iqP4ifgdyK4zyDNdbbZLEqxXMcAsbdFVTcoO9nvJutA=; b=kG/CbVNI1K/9ErFr5Nutlv6NXTT+qD9PCvffJbhDDX1czriWZ1vHD9kXIztuh2EGb/ eyCNdHaJD2t94SZnP52tfZ9fnaCZSZRshrP/WM0SB8p4VJoAV3YMDPL23zZfoijqx7Ak PP/3r4fHI/g3O5dygTfYy9ZgJrOfGcoSNgg+KtYsB12FGoVIb0QBzuRqaZEp4NnnJUQD 0/tJwXOqL5MzbJ38HIDl59Ro1r7nyvkeQ9GBpdtQpNrstMsTHoqqm+SLy/fF8LXpWoEm 2xqDqzlMbp1JVtS/klRb6OPBiZVFj4UGyGKCc4/GJDdNCUkOvpmOzORD9h1Ms7+PNWMW 8V4g== X-Gm-Message-State: AGRZ1gJcBiLBcUFS1FvERfKxNh/X4fNJh6P9OxyduFLb/FefxkT6Rvze FncVYdCoM0blFde6MLXrJkf8HxIKEhw= X-Google-Smtp-Source: AJdET5eSxc+Fj3YSSQZPhSTPMQcHsqozmbn0X44EurgSQdgDPZvZt44gf8j8gwBw4vTpVPwE3IeAGA== X-Received: by 2002:a1c:2746:: with SMTP id n67-v6mr6795934wmn.116.1540595278669; Fri, 26 Oct 2018 16:07:58 -0700 (PDT) Received: from u.nix.is ([2a01:4f8:190:5095::2]) by smtp.gmail.com with ESMTPSA id 4-v6sm5632830wmt.16.2018.10.26.16.07.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Oct 2018 16:07:58 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Stefan Beller , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFy?= =?utf-8?b?bWFzb24=?= Subject: [PATCH v3 6/8] push: test that doesn't DWYM if is unqualified Date: Fri, 26 Oct 2018 23:07:39 +0000 Message-Id: <20181026230741.23321-7-avarab@gmail.com> X-Mailer: git-send-email 2.19.1.759.g500967bb5e In-Reply-To: <20181026192734.9609-1-avarab@gmail.com> References: <20181026192734.9609-1-avarab@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a test asserting that "git push origin :" where is a branch, tag, tree or blob in refs/remotes/* doesn't DWYM when is unqualified. This has never worked, but there's been no test for this behavior. See f88395ac23 ("Renaming push.", 2005-08-03), bb9fca80ce ("git-push: Update description of refspecs and add examples", 2007-06-09) and f8aae12034 ("push: allow unqualified dest refspecs to DWIM", 2008-04-23) which are most relevant commits that have changed or documented the behavior of this feature in the past. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t5505-remote.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh index 2e58721f98..979a13b415 100755 --- a/t/t5505-remote.sh +++ b/t/t5505-remote.sh @@ -1246,5 +1246,33 @@ test_expect_success 'unqualified refspec DWIM and advice' ' ) ' +test_expect_success 'refs/remotes/* refspec and unqualified DWIM and advice' ' + ( + cd two && + git tag -a -m "Some tag" some-tag master && + git update-ref refs/trees/my-head-tree HEAD^{tree} && + git update-ref refs/blobs/my-file-blob HEAD:file + ) && + ( + cd test && + git config --add remote.two.fetch "+refs/tags/*:refs/remotes/two-tags/*" && + git config --add remote.two.fetch "+refs/trees/*:refs/remotes/two-trees/*" && + git config --add remote.two.fetch "+refs/blobs/*:refs/remotes/two-blobs/*" && + git fetch --no-tags two && + + test_must_fail git push origin refs/remotes/two/another:dst 2>err && + test_i18ngrep "error: The destination you" err && + + test_must_fail git push origin refs/remotes/two-tags/some-tag:dst-tag 2>err && + test_i18ngrep "error: The destination you" err && + + test_must_fail git push origin refs/remotes/two-trees/my-head-tree:dst-tree 2>err && + test_i18ngrep "error: The destination you" err && + + test_must_fail git push origin refs/remotes/two-blobs/my-file-blob:dst-blob 2>err && + test_i18ngrep "error: The destination you" err + ) +' + test_done