From patchwork Tue May 19 18:31:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Tan X-Patchwork-Id: 11558511 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 634121391 for ; Tue, 19 May 2020 18:31:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 46D8D2075F for ; Tue, 19 May 2020 18:31:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="d5g8iXzE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726722AbgESSbz (ORCPT ); Tue, 19 May 2020 14:31:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726161AbgESSbz (ORCPT ); Tue, 19 May 2020 14:31:55 -0400 Received: from mail-qt1-x849.google.com (mail-qt1-x849.google.com [IPv6:2607:f8b0:4864:20::849]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87360C08C5C0 for ; Tue, 19 May 2020 11:31:55 -0700 (PDT) Received: by mail-qt1-x849.google.com with SMTP id r9so313147qtn.20 for ; Tue, 19 May 2020 11:31:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=8NRW6ne8SCkRzv8mSkxWorADk8k4EhazCy6Lw0VPafk=; b=d5g8iXzEecMlPYgo6nXGwEK0v56k8blgPfduS9ge/Inovywy6h36kvenFUXMJqcSYL ZcGsmZpcf1adGSupJ9B8cIgLVHBWLh/JhlCD6aaGf/gE4jugIs2CZVlDgS2KsC4Ih2aZ 0w333qQGEd+Pxbk+6U29+Qj+Ik5YoF+46dfi51KG3e4KUXie5v7OmaFaObbZbbjqcFLm R14PhfbSkXy4tg8sH+XlsQ4iAgzx2T8uq06fJirZhs1fgrbikCeZGhr8oKsAp3UPc3xN Zc1dlsXUZKxC/W+aletW325bEadzYMRIpi1LfM+guvhhQxbE5O70EKQXpH6yXTqKOHY6 rwsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=8NRW6ne8SCkRzv8mSkxWorADk8k4EhazCy6Lw0VPafk=; b=NEFQdSPzQ3gnBCcBT9kYGqmrB/hQMp/YAjDFjVvngEBF9u8pSMi9O2InHN5/pz56Dc N7bcPEzvsjGfz1WbbxV0k9NxvxnsAqrRyOO9mEKS3F0tXRKD+NU+WhenVt73NxBV0CeY zV3IHqi0BeLeAeb4edxihvFA7bLLnU573YSL84epOxVzjJfPhv5n3ypr7RT1QWHc6LBl bzAkmMbxdvP9BFgjGTzc1tu0wHRrtlkz+LnWQCoG5BAHApEMswHgweki5gQZ6zxTftLv ywrt4XfKPgPTb3jxAtlleju5Vvtre0uJJCG6C8yVVDxjSy9OG20xmNfbhNVm16xr/Pas Rljw== X-Gm-Message-State: AOAM532i6SOXK9Td+bpubxIxPD7VXp2V+CNjhpIFUSAoGKTtjBR95TId NQeftmUGvaLwMu2yAuub07WB467LCxAEf1Y6d9uep4tA1NJrUJKnskdp2PbpAvZf38yLAVyIhs5 MCuctCfKuP6D64D1AQ6dzqenm0fbHm7G7GJPzFmIfVEECTD1EuYDxNKIgqGR01Q1OYgKSgWbWKR NX X-Google-Smtp-Source: ABdhPJzwoHOaJeHZ1iu/SsM78V3Ca/xDNJhjkXdof/8UAqhpoPgUN2wgkJPXYG0qH4QeRlG/Qi+7duJfDjSvX5SgUyO2 X-Received: by 2002:a25:d0d5:: with SMTP id h204mr985989ybg.430.1589913113870; Tue, 19 May 2020 11:31:53 -0700 (PDT) Date: Tue, 19 May 2020 11:31:51 -0700 In-Reply-To: Message-Id: <20200519183151.46138-1-jonathantanmy@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog Subject: [PATCH] t4067: make rename detection test output raw diff From: Jonathan Tan To: git@vger.kernel.org Cc: Jonathan Tan , stolee@gmail.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org 95acf11a3d ("diff: restrict when prefetching occurs", 2020-04-07) taught diff to prefetch blobs in a more limited set of situations. These limited situations include when the output format requires blob data, and when inexact rename detection is needed. There is an existing test case that tests inexact rename detection, but it also uses an output format that requires blob data, resulting in the inexact-rename-detection-only code not being tested. Update this test to use the raw output format, which does not require blob data. Thanks to Derrick Stolee for noticing this lapse in code coverage and for doing the preliminary analysis [1]. [1] https://lore.kernel.org/git/853759d3-97c3-241f-98e1-990883cd204e@gmail.com/ Signed-off-by: Jonathan Tan --- Thanks, Stolee. Yes, we were never in a situation where there are any missing objects at the point of inexact rename detection (despite having a test exactly for this), but this situation is possible, and I've updated the test so that we encounter this situation. --- t/t4067-diff-partial-clone.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t4067-diff-partial-clone.sh b/t/t4067-diff-partial-clone.sh index c1ed1c2fc4..ef8e0e9cb0 100755 --- a/t/t4067-diff-partial-clone.sh +++ b/t/t4067-diff-partial-clone.sh @@ -125,8 +125,8 @@ test_expect_success 'diff with rename detection batches blobs' ' # Ensure that there is exactly 1 negotiation by checking that there is # only 1 "done" line sent. ("done" marks the end of negotiation.) - GIT_TRACE_PACKET="$(pwd)/trace" git -C client diff -M HEAD^ HEAD >out && - grep "similarity index" out && + GIT_TRACE_PACKET="$(pwd)/trace" git -C client diff --raw -M HEAD^ HEAD >out && + grep ":100644 100644.*R[0-9][0-9][0-9].*b.*c" out && grep "git> done" trace >done_lines && test_line_count = 1 done_lines ' From patchwork Thu May 21 02:07:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11562069 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 152BD159A for ; Thu, 21 May 2020 02:07:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E9299206D4 for ; Thu, 21 May 2020 02:07:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="z6ypRgY3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726943AbgEUCHX (ORCPT ); Wed, 20 May 2020 22:07:23 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:38560 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726840AbgEUCHW (ORCPT ); Wed, 20 May 2020 22:07:22 -0400 Received: from camp.crustytoothpaste.net (unknown [IPv6:2001:470:b978:101:b610:a2f0:36c1:12e3]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by injection.crustytoothpaste.net (Postfix) with ESMTPSA id 48EB46081C; Thu, 21 May 2020 02:07:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1590026841; bh=u0F7TYsiSuPsD5di/m95+1LRvD9Z5KHOK/3MDxTh3Dg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Reply-To: Subject:Date:To:CC:Resent-Date:Resent-From:Resent-To:Resent-Cc: In-Reply-To:References:Content-Type:Content-Disposition; b=z6ypRgY3582rd4oQxfsYUHL7mdky4Rq9Au6A8EbT+O3JqdsojjpnSTBZziaN1a6rJ QoLMgqS9HTV5HmiqElqb3i/uxa2v0XFRnmU5rxbaE9q2Z0W3PZL0HLdCebXsDcYWu8 VuQFgiZtUo9idGvs7O9YWBIwtzOnMjX3ck50fCcK9os5/CpeojqTNvnAJvThS/vhNu NwthF/qRZHK6ZesgrELp2ayB6xxe/CqZNjmztkRoG8AREw1EfYmRzze/i74qdwIjcp JTwXISLQJvCW+9GGJwIaLElQpvBPc4BLaVdScCCCAayslEcgdbxHJNUWFkfmRRhSs6 0J0UAA+4/zCLhzQop9IjJ46K3jDU81Qju0/17u3nNXKbXkQaKcBVgThVja56EJKE6l N90vi7pct+2qfTB8uHc54zwQMfLDGRz7KiC9MShr726BveXsB8tTmfbnqen1aeObzJ arSlND5yqyY1N2EgvjIgfsFLK2Go9c9RAcC2MCrqN6FDEDIuJya From: "brian m. carlson" To: Cc: Derrick Stolee , Junio C Hamano Subject: [PATCH v2 2/2] t2060: add a test for switch with --orphan and --discard-changes Date: Thu, 21 May 2020 02:07:12 +0000 Message-Id: <20200521020712.1620993-3-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.27.0.rc0.183.gde8f92d652 In-Reply-To: <20200521020712.1620993-1-sandals@crustytoothpaste.net> References: <20200521020712.1620993-1-sandals@crustytoothpaste.net> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We have several code paths in the checkout code which are traversed only in this case, due to switch having different defaults from checkout. Let's add a test that the combination of options works and produces the expected behavior. Signed-off-by: brian m. carlson --- t/t2060-switch.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/t/t2060-switch.sh b/t/t2060-switch.sh index f9efa29dfb..2c1b8c0d6d 100755 --- a/t/t2060-switch.sh +++ b/t/t2060-switch.sh @@ -68,6 +68,14 @@ test_expect_success 'new orphan branch from empty' ' test_cmp expected tracked-files ' +test_expect_success 'orphan branch works with --discard-changes' ' + test_when_finished git switch master && + echo foo >foo.txt && + git switch --discard-changes --orphan new-orphan2 && + git ls-files >tracked-files && + test_must_be_empty tracked-files +' + test_expect_success 'switching ignores file of same branch name' ' test_when_finished git switch master && : >first-branch &&