From patchwork Sat Apr 4 01:11:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11473961 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 3991E912 for ; Sat, 4 Apr 2020 01:12:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 173DA20731 for ; Sat, 4 Apr 2020 01:12:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="q1M05W5+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726887AbgDDBMZ (ORCPT ); Fri, 3 Apr 2020 21:12:25 -0400 Received: from mail-qv1-f65.google.com ([209.85.219.65]:46338 "EHLO mail-qv1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726681AbgDDBMX (ORCPT ); Fri, 3 Apr 2020 21:12:23 -0400 Received: by mail-qv1-f65.google.com with SMTP id bu9so4574740qvb.13 for ; Fri, 03 Apr 2020 18:12:22 -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=Y3JpD1BmGlEgxfNhigHedIBI5YZ1431gBF8qqQU816M=; b=q1M05W5+ZPyxwEs2CAwUMdYonBSe83Th+gflSB846XvdgelJPz7m0X2DOQDK8JC7LY gjPFU3qu6JTLPpNnUC/MTJzekOTHMAVXwUg8LtA8xcvCtz/JmpqG2l+xZdV/kAahz93a jKrDtecdGOQZkxMXC/hMKP7eiJ3vOpDyIgSvThDsLLa/NXzz4gXw0c3ss3aUdhDnntZ2 RJAtE+bQ/A/MnhzwnQeEc7DSPnE/777Xv9qNmtzh4/TKQ3Syj0h3ZjTZRLPDMFWiv8gk WVpRip4szhZA2LFoe9IG95kZGkyRwwzDjoBYs5e+Kca3kkE1P4lXKjbnnuIG7djrXh1W CAgg== 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=Y3JpD1BmGlEgxfNhigHedIBI5YZ1431gBF8qqQU816M=; b=kX00MfFCCy/9poWcuAi1Eqmf7jTIjpsJtlW4NtsMkRqnmw/4Mn2TslDr3dsX5W7CNr M1chtTRYX9YF5+E1teKfPUiyJ0CdgsDtJiANmrXjqeXsjUr/xnJGUTjtxtuZCNPlq4Bk 75M+DBUI2zUqd5m6GLERl6dcKUCCB/utHSx+hzH/+dEVA4SXwaoLgpRPPbsRFhJtCq/8 TZJGfKlNru7z0F0+3arV4Iz/pGSKHqIU9lLuEBB+PJUPasp1JdGYCtyAGZVOWw/3e9uI OmlW7gZYmC1LWaW/kRU5gx2u1r8JI+eEKWQxKG2hIz7LRGi/2XqVpx/m0YThnRBFB6OC QqgA== X-Gm-Message-State: AGi0Pual+uyF94ODoBlRqjSUW85fAyA3Z9sCwzJ+NRyA8NOpUSBqZWnd zFLr2JAWtxGgLi5gdv+OiKNkPJ5f X-Google-Smtp-Source: APiQypILVaMO44g35dnaREs/IBwZTdQtuVlqYmrm+r4UuOWBEQE0CIvX/IWvPIk0UK7E5EVDF/DPnA== X-Received: by 2002:a05:6214:1e5:: with SMTP id c5mr11172489qvu.233.1585962742200; Fri, 03 Apr 2020 18:12:22 -0700 (PDT) Received: from localhost.localdomain (ktnron0919w-grc-01-76-68-143-128.dsl.bell.ca. [76.68.143.128]) by smtp.gmail.com with ESMTPSA id a136sm3297503qkc.75.2020.04.03.18.12.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 18:12:21 -0700 (PDT) From: Denton Liu To: Git Mailing List Cc: Alban Gruin , Johannes Schindelin , Junio C Hamano , Phillip Wood Subject: [PATCH v4 22/23] t5520: make test_pull_autostash() accept expect_parent_num Date: Fri, 3 Apr 2020 21:11:35 -0400 Message-Id: X-Mailer: git-send-email 2.26.0.159.g23e2136ad0 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Before, test_pull_autostash() was hardcoded to run `test_cmp_rev HEAD^ copy` to test that a rebase happened. However, in a future patch, we plan on testing merging as well. Make test_pull_autostash() accept a parent number as an argument so that, in the future, we can test if a merge happened in addition to a rebase. Signed-off-by: Denton Liu --- t/t5520-pull.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 2f86fca042..f610dc14de 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -10,11 +10,13 @@ modify () { } test_pull_autostash () { + expect_parent_num="$1" && + shift && git reset --hard before-rebase && echo dirty >new_file && git add new_file && git pull "$@" . copy && - test_cmp_rev HEAD^ copy && + test_cmp_rev HEAD^"$expect_parent_num" copy && echo dirty >expect && test_cmp expect new_file && echo "modified again" >expect && @@ -369,22 +371,22 @@ test_expect_success '--rebase fails with multiple branches' ' test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' ' test_config rebase.autostash true && - test_pull_autostash --rebase + test_pull_autostash 1 --rebase ' test_expect_success 'pull --rebase --autostash & rebase.autostash=true' ' test_config rebase.autostash true && - test_pull_autostash --rebase --autostash + test_pull_autostash 1 --rebase --autostash ' test_expect_success 'pull --rebase --autostash & rebase.autostash=false' ' test_config rebase.autostash false && - test_pull_autostash --rebase --autostash + test_pull_autostash 1 --rebase --autostash ' test_expect_success 'pull --rebase --autostash & rebase.autostash unset' ' test_unconfig rebase.autostash && - test_pull_autostash --rebase --autostash + test_pull_autostash 1 --rebase --autostash ' test_expect_success 'pull --rebase --no-autostash & rebase.autostash=true' ' @@ -422,7 +424,7 @@ test_expect_success 'pull.rebase' ' test_expect_success 'pull --autostash & pull.rebase=true' ' test_config pull.rebase true && - test_pull_autostash --autostash + test_pull_autostash 1 --autostash ' test_expect_success 'pull --no-autostash & pull.rebase=true' '