From patchwork Mon Dec 16 15:48:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Blain via GitGitGadget X-Patchwork-Id: 11294459 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 011F4186D for ; Mon, 16 Dec 2019 15:48:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D33F220717 for ; Mon, 16 Dec 2019 15:48:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="l0lifen6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728532AbfLPPsX (ORCPT ); Mon, 16 Dec 2019 10:48:23 -0500 Received: from mail-wm1-f50.google.com ([209.85.128.50]:34998 "EHLO mail-wm1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728547AbfLPPsV (ORCPT ); Mon, 16 Dec 2019 10:48:21 -0500 Received: by mail-wm1-f50.google.com with SMTP id p17so7251770wmb.0 for ; Mon, 16 Dec 2019 07:48:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=5MgGYeWMCCRYnae/q9iD5uMWOQfLIJcWu0JLO6ISVv0=; b=l0lifen6BYvK/XFiVXg2Kv/rTotX7m89Nk3c7h/sXBv2JovE5VkI77MEaPcC6THJPq 6rMNNo/rvXjqXwizyTNPwhChfkpx8/Z/Aga/TqXuPAI2H2t7VKGo8SX2MARQokdaACoS 2HSd8X0wxl4hDGNn7k4pS7sO6vHTvcmu5Nke1uAQCH3wQR2U+muxDQbAzscFSldVcSFT ZaE1gVmkd5Jq38S496XSty9ckSgfmMPkxW4ycGUUpkN9/uaHQs5Z8LWe3b5ar0ZX1f4f J3NJKI9srSLtJOLBQbMVgNVDPEl9YrDlbn9dUTowPvDIPsFeAqT9HDeezAOIUAxputaW iW0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=5MgGYeWMCCRYnae/q9iD5uMWOQfLIJcWu0JLO6ISVv0=; b=ZqI0+Luue/ad7jB5ApEVgpost1Hl3kbcbaK1+hKI9lsrGi4m1gURrTuzfeZ80HodHF MRNA5DmmnFXJfckmMpHxy5S2KMPs8KR46u22R30bwisfW9IpMddj7VafT2uj2602fonh lpyN9WDHf36kh5pY6BvTwNKD4yi9YCiNSnAWS9rr2TT9xJxhiLTbL2s5jVx1WDJc02qk wIlK1GPQxSen54WrgrrjPZYb1FYxx7Qc8IF1tXtjVjwOMZjdPYJRb/d5WEvC5DzmACk2 8KBZtLPxiFM1LEyUR22OLw0qgrPy1prY60s7kegZZGoUfRZKhCtkh+OUyNir0CdhkuuN /aOw== X-Gm-Message-State: APjAAAUq5PEtDHon/xJi4fa01zLP4GjsJ/ja9FwJqWHkr6HGsfumyolI 5lOSb3cLs4uE4+M2aq71qs2Bkkzj X-Google-Smtp-Source: APXvYqyHa7+5QC5Di0C0Ey4O4nDwnVUuSqMAQ1fAk3l1m5sWoKkJNOSNfvT0yGN/27+Tg4DJlkhfyQ== X-Received: by 2002:a1c:f213:: with SMTP id s19mr33061172wmc.42.1576511299773; Mon, 16 Dec 2019 07:48:19 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id l15sm21699174wrv.39.2019.12.16.07.48.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Dec 2019 07:48:19 -0800 (PST) Message-Id: <542eb709cac341e038ef04f0107e3d2dbaddf97a.1576511287.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Alexandr Miloslavskiy via GitGitGadget" Date: Mon, 16 Dec 2019 15:48:05 +0000 Subject: [PATCH v2 17/18] t2024: cover more cases Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Phillip Wood , Junio C Hamano , Emily Shaffer , Derrick Stolee , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Alexandr Miloslavskiy , Junio C Hamano , Alexandr Miloslavskiy Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Alexandr Miloslavskiy After working on `parse_branchname_arg()` I think that these cases are worth testing. Signed-off-by: Alexandr Miloslavskiy --- t/t2024-checkout-dwim.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/t/t2024-checkout-dwim.sh b/t/t2024-checkout-dwim.sh index c35d67b697..fd993bf45d 100755 --- a/t/t2024-checkout-dwim.sh +++ b/t/t2024-checkout-dwim.sh @@ -156,6 +156,33 @@ test_expect_success 'checkout of branch from a single remote succeeds #2' ' test_branch_upstream baz repo_b baz ' +test_expect_success 'checkout of branch from a single remote succeeds with --' ' + git checkout -B master && + test_might_fail git branch -D baz && + + git checkout baz -- && + status_uno_is_clean && + test_branch baz && + test_cmp_rev remotes/other_b/baz HEAD && + test_branch_upstream baz repo_b baz +' + +test_expect_success 'dont DWIM with pathspec #1' ' + git checkout -B master && + test_might_fail git branch -D baz && + + test_must_fail git checkout baz nonExistingFile 2>err && + test_i18ngrep "did not match any file(s) known to git" err +' + +test_expect_success 'dont DWIM with pathspec #2' ' + git checkout -B master && + test_might_fail git branch -D baz && + + test_must_fail git checkout baz -- nonExistingFile 2>err && + test_i18ngrep "fatal: invalid reference: baz" err +' + test_expect_success '--no-guess suppresses branch auto-vivification' ' git checkout -B master && status_uno_is_clean &&