From patchwork Sun Sep 20 07:48:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luke Diamand X-Patchwork-Id: 11787347 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 E41ED92C for ; Sun, 20 Sep 2020 07:48:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C9C90222BB for ; Sun, 20 Sep 2020 07:48:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=diamand.org header.i=@diamand.org header.b="D0aCVqeS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726267AbgITHsh (ORCPT ); Sun, 20 Sep 2020 03:48:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726222AbgITHsg (ORCPT ); Sun, 20 Sep 2020 03:48:36 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30575C0613CE for ; Sun, 20 Sep 2020 00:48:36 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id e16so9614340wrm.2 for ; Sun, 20 Sep 2020 00:48:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=diamand.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=a3+8o+Pkv86RatJxIg7b5qzWe8Nyaje1rGtKQffx7SE=; b=D0aCVqeStepHE27wA0fbTKrNMeX/RyIRRG6OhdbcXYKrVa+hRAVaF7dAiOzQmK5lLs IK4QD1ahv3WcmdkwLNeHBjzpd+XZBWKIb9zAdXve+NngcRsFWirphqOsjBn8+JrBVK2A VK1PJEZ+SCpdKU443e4rK203Lx9Ten40XyOa4= 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=a3+8o+Pkv86RatJxIg7b5qzWe8Nyaje1rGtKQffx7SE=; b=Esofjn0itW0nhJGpWwrbcKpKDAilCUHrKs2eFtgqWVUMi7OXb4YkGbyujfMr0RSAaM 4H0btsOiBReW5griiShD+KN44jN3luC1ybqgPgXmHCujhgd5Q5khEVAdpuU89A2WepNj 9CuIzo4f91/DCJt6x4dsikjJTIvvZu12jB1uDQbbKb7YIi9Yvg//qJTti91uWdODc3q7 Zvk9iiCK6h9aMzCK1nR0v5h7Ykhqe2BWF1bF64A/soD18uFl+XNdAgm7TGeY2CwP34tH vqvn6w/ng410+H4PotMJimJH3odQGL+JVREJqLjHc/anxD0629rOrh8BYjkRvhUcD0df SnuQ== X-Gm-Message-State: AOAM533tV+jNw0cNsv7vgikqQ7NPDL3c6UdLuL10GpEbX7mNzp9xDGv2 oJYFuPzbRsIavu+2cOEE9XNBIzFWjufiyQ== X-Google-Smtp-Source: ABdhPJw95zpJc4ZgunC3d+4J2hKFS1CZtqbwOlJnwlgpe3TTC/pk8kfJsgIXOHMedI0R+n1v6GJjbw== X-Received: by 2002:adf:e304:: with SMTP id b4mr44879655wrj.141.1600588114673; Sun, 20 Sep 2020 00:48:34 -0700 (PDT) Received: from ethel.local.diamand.org (cpc149478-cmbg20-2-0-cust747.5-4.cable.virginm.net. [86.16.90.236]) by smtp.gmail.com with ESMTPSA id u17sm15140329wri.45.2020.09.20.00.48.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Sep 2020 00:48:34 -0700 (PDT) From: Luke Diamand To: git@vger.kernel.org Cc: "Liu Xuhui (Jackson)" , Eric Sunshine , Luke Diamand Subject: [PATCHv2 1/2] git-p4: demonstrate `unshelve` bug Date: Sun, 20 Sep 2020 08:48:40 +0100 Message-Id: <20200920074841.17043-2-luke@diamand.org> X-Mailer: git-send-email 2.28.0.762.g324f61785e In-Reply-To: <20200920074841.17043-1-luke@diamand.org> References: <20200920074841.17043-1-luke@diamand.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org `git-p4 unshelve` uses HEAD^$n to find the parent commit, which fails if there is an additional commit. Augment the tests to demonstrate this problem. Signed-off-by: Luke Diamand --- t/t9832-unshelve.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/t/t9832-unshelve.sh b/t/t9832-unshelve.sh index e9276c48f4..feda4499dd 100755 --- a/t/t9832-unshelve.sh +++ b/t/t9832-unshelve.sh @@ -29,8 +29,11 @@ test_expect_success 'init depot' ' ) ' +# Create an initial clone, with a commit unrelated to the P4 change +# on HEAD test_expect_success 'initial clone' ' - git p4 clone --dest="$git" //depot/@all + git p4 clone --dest="$git" //depot/@all && + test_commit -C "$git" "unrelated" ' test_expect_success 'create shelved changelist' ' @@ -77,7 +80,7 @@ EOF ) ' -test_expect_success 'update shelved changelist and re-unshelve' ' +test_expect_failure 'update shelved changelist and re-unshelve' ' test_when_finished cleanup_git && ( cd "$cli" && From patchwork Sun Sep 20 07:48:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luke Diamand X-Patchwork-Id: 11787349 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 16AD06CA for ; Sun, 20 Sep 2020 07:48:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F00A5221EC for ; Sun, 20 Sep 2020 07:48:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=diamand.org header.i=@diamand.org header.b="URhkDW9H" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726306AbgITHsk (ORCPT ); Sun, 20 Sep 2020 03:48:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726222AbgITHsh (ORCPT ); Sun, 20 Sep 2020 03:48:37 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28DE0C061755 for ; Sun, 20 Sep 2020 00:48:37 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id w5so9591084wrp.8 for ; Sun, 20 Sep 2020 00:48:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=diamand.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8KSMdmLX4/XV558FNQh9XA/B7e6fkFxHu/ERlT3qPCM=; b=URhkDW9HD1QGlsyjqmaEKXq5LJeVXJwNYtihOw5VJ2F+L4v+RjKVST1g9cE7KbW+q8 DbtbXCdyv1RZfO7iWDmbPscDml/XmOmiHbpaZwoqh4GMqzKltR9CJeQUMyN8cZrSDqFW XTp/0+I/mlJHFsNkXDHbcia9RH6u4SC9lLVmY= 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=8KSMdmLX4/XV558FNQh9XA/B7e6fkFxHu/ERlT3qPCM=; b=hrrK9bp+lUQz3k1e/bbQqZNnAS3QQDWwm9xY1/lw4jumfyFndImgu8r2Gr8n8a8uOC 6D46nWNNggg5GlqdzwJacUtcUOOyQAYlmSBIgs6u7ulpaZ/nME7jqAYbnstDCQ8yhMyu g1jEl4iQdoPLJNR643wPOzd9GsYLz0qwzE/SHJDJJKaPpCVuqIXqq6GJPuIt9gZDh5oC iuCf7Q8mR9Ml8ZkhaqDhU9PtC4X+ikPbqOAVl/jzg1JYt0hNWUAhr7bBF5heH8LSALeO /MBBaXO5QWVhsFYsSQ7aWxXp4xWY9TU4PvFHg2epPTfdQjdrni9Al4PcSaxhxUQvrsTq sThw== X-Gm-Message-State: AOAM532rMzqeUDSL27FSyLEXN70cpFIbk0A4fwKOonVElk0SqyLGnRg1 trhGV2vYfJjsnfu2wrSySwbVWLcKEqbPSw== X-Google-Smtp-Source: ABdhPJwHcelEaUDZETvCXZLAQNBoHmUPM8Ak1SRNrKI1fz2XWRjBT1jgA/8+rauhFGZXHv/4ZzvxWw== X-Received: by 2002:adf:dd0b:: with SMTP id a11mr45409778wrm.422.1600588115691; Sun, 20 Sep 2020 00:48:35 -0700 (PDT) Received: from ethel.local.diamand.org (cpc149478-cmbg20-2-0-cust747.5-4.cable.virginm.net. [86.16.90.236]) by smtp.gmail.com with ESMTPSA id u17sm15140329wri.45.2020.09.20.00.48.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Sep 2020 00:48:35 -0700 (PDT) From: Luke Diamand To: git@vger.kernel.org Cc: "Liu Xuhui (Jackson)" , Eric Sunshine , Luke Diamand Subject: [PATCHv2 2/2] git-p4: fix `unshelve` bug finding parent commit Date: Sun, 20 Sep 2020 08:48:41 +0100 Message-Id: <20200920074841.17043-3-luke@diamand.org> X-Mailer: git-send-email 2.28.0.762.g324f61785e In-Reply-To: <20200920074841.17043-2-luke@diamand.org> References: <20200920074841.17043-1-luke@diamand.org> <20200920074841.17043-2-luke@diamand.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org `unshelve` was using HEAD^$n to find the parent commit. This meant that any intervening commits between HEAD and the last git-p4 commit would cause the unshelve to fail. e.g. 123ab Local git-only commit 234bc Another local git-only commit 345cd Perforce tip revision Unshelve needs to find 345cd. Use HEAD~$n instead. Reported-by: Liu Xuhui (Jackson) Signed-off-by: Luke Diamand --- git-p4.py | 2 +- t/t9832-unshelve.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/git-p4.py b/git-p4.py index ca79dc0900..4433ca53de 100755 --- a/git-p4.py +++ b/git-p4.py @@ -4237,7 +4237,7 @@ def findLastP4Revision(self, starting_point): """ for parent in (range(65535)): - log = extractLogMessageFromGitCommit("{0}^{1}".format(starting_point, parent)) + log = extractLogMessageFromGitCommit("{0}~{1}".format(starting_point, parent)) settings = extractSettingsGitLog(log) if 'change' in settings: return settings diff --git a/t/t9832-unshelve.sh b/t/t9832-unshelve.sh index feda4499dd..7194fb2855 100755 --- a/t/t9832-unshelve.sh +++ b/t/t9832-unshelve.sh @@ -80,7 +80,7 @@ EOF ) ' -test_expect_failure 'update shelved changelist and re-unshelve' ' +test_expect_success 'update shelved changelist and re-unshelve' ' test_when_finished cleanup_git && ( cd "$cli" &&