From patchwork Wed Oct 7 07:56:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11819917 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 EA6026CB for ; Wed, 7 Oct 2020 07:56:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C02442083B for ; Wed, 7 Oct 2020 07:56:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FVKUoU2c" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727835AbgJGH43 (ORCPT ); Wed, 7 Oct 2020 03:56:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727830AbgJGH42 (ORCPT ); Wed, 7 Oct 2020 03:56:28 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 675F9C061755 for ; Wed, 7 Oct 2020 00:56:28 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id 34so848500pgo.13 for ; Wed, 07 Oct 2020 00:56:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=U4n2v+dJHIiHGZtBxeT6+F0Xumd7zVgfX09RJlpl2GA=; b=FVKUoU2cBLt/5ggMR5b4BUEggdjh/QicPDEv82iOORnRwQbCN6h3/z3nzNVGjFyCvL g5Eje0aJh0TTp7c4n0jLAS+PSSmriTecrYmHOGE7plggr4HJoQlY40+onobn26zX7sOF nx071THsONNUh7nq0c1afuQafeyWJ1icSXVtrwSuI5P1QHelJvCoKaGJOnINxNM6OizG QybMIRA2U+8L+02uhAxUINnmqg5cqFRPEFpzObnY3N42hE2cvKTGx4avJwu3MwWu4sQQ VHPCfux7U6y44rs5Y3zDnmuYP45EeLW3rtErOzjOSqp1Nf1VJNfAo7IbPWYexesnm6Vs HQmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=U4n2v+dJHIiHGZtBxeT6+F0Xumd7zVgfX09RJlpl2GA=; b=YYv/uJLTeJrZTpbWTDmAgMp7YXOM2UBcbDAud4wa4wXLg+fzT7POYL2aW0xED0XHHX mJrVjYOO1LvZCJ7gNKjHjDQbOIF4tGKlMolk6FySX3uucQxnGB4ZL+oaTSNjkxEyrQHS 62jSpONxm9vxGGWzQrDWBgkozKM0VfCQsoRTRU3gKuL3VWUcQk6F7lz5q0wbh6YZjDA8 z6fwmv+pJsaXdMDK22JFAEh1TS57Djxzc7wCL2UzihPnHRznhIdZ5Ic/WYcIA0b84Ge9 vXGpW6NTtIVj4QzW0pq777+EyTmwwwlVI7yNcs/FOP1iD8Ti9w4euIbM8nzeqJ3tputM PL1A== X-Gm-Message-State: AOAM530DdfCOedelJ6XZTOHlkUrFRGhCgwPQCxI7HyTRMOHo4v9ihdGi 239rhZk0uQriUGxU3EyP+o4W+4F7sSY= X-Google-Smtp-Source: ABdhPJyJSfUGfjoBEAt3prJ661U2gSkqKkHjvsIse8JwB7okGN14lmGBCyvDy7WnRg8Tw2jZWMHOUA== X-Received: by 2002:a62:545:0:b029:142:2501:35db with SMTP id 66-20020a6205450000b0290142250135dbmr1894530pff.59.1602057387759; Wed, 07 Oct 2020 00:56:27 -0700 (PDT) Received: from archbookpro.hsd1.ca.comcast.net (c-67-188-114-10.hsd1.ca.comcast.net. [67.188.114.10]) by smtp.gmail.com with ESMTPSA id n9sm1909950pgi.2.2020.10.07.00.56.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Oct 2020 00:56:27 -0700 (PDT) From: Denton Liu To: Git Mailing List Subject: [PATCH v2 2/4] Doc: document "A...B" form for in checkout and switch Date: Wed, 7 Oct 2020 00:56:16 -0700 Message-Id: X-Mailer: git-send-email 2.28.0.942.g77c4c6094c In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Using "A...B" has been supported for the argument for a while. However, its support has never been explicitly documented. Explicitly document it so that users know that it is available. Signed-off-by: Denton Liu --- Documentation/git-checkout.txt | 4 ++++ Documentation/git-restore.txt | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index afa5c11fd3..6ae8bf8dee 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -351,6 +351,10 @@ leave out at most one of `A` and `B`, in which case it defaults to `HEAD`. :: Tree to checkout from (when paths are given). If not specified, the index will be used. ++ +As a special case, you may use `"A...B"` as a shortcut for the +merge base of `A` and `B` if there is exactly one merge base. You can +leave out at most one of `A` and `B`, in which case it defaults to `HEAD`. \--:: Do not interpret any more arguments as options. diff --git a/Documentation/git-restore.txt b/Documentation/git-restore.txt index 84c6c40010..55bde91ef9 100644 --- a/Documentation/git-restore.txt +++ b/Documentation/git-restore.txt @@ -40,6 +40,10 @@ OPTIONS + If not specified, the contents are restored from `HEAD` if `--staged` is given, otherwise from the index. ++ +As a special case, you may use `"A...B"` as a shortcut for the +merge base of `A` and `B` if there is exactly one merge base. You can +leave out at most one of `A` and `B`, in which case it defaults to `HEAD`. -p:: --patch:: From patchwork Wed Oct 7 07:56:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11819925 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 E1E49618 for ; Wed, 7 Oct 2020 07:56:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B7024207EA for ; Wed, 7 Oct 2020 07:56:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ks467bRx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727838AbgJGH4e (ORCPT ); Wed, 7 Oct 2020 03:56:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727832AbgJGH43 (ORCPT ); Wed, 7 Oct 2020 03:56:29 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F051C061755 for ; Wed, 7 Oct 2020 00:56:29 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id o8so597166pll.4 for ; Wed, 07 Oct 2020 00:56:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=gBO5fykvGQ+RmuON1CwFXQzWBEFVVNtnRsGW7Oa/xDc=; b=Ks467bRxMJPXaE6aE3+5D4BjZLRDrDrTsF8+3h4vD5adQB9J1qpAcww2Sf9fbIsej1 71fEJyne19vZJGZnVuSwsddgNvG44awukVAJryfzaVfeUE3B/XMtftlWpjY+dJ+JOr7M tVXKt5p5tPjFxsWLDNHQHyzFKhwN97ArgSJj6Fk7tkW9kiPmBDidkaISLEuuIuH08z88 mYS696+xYnFkCmuURkwwMrFPuNn32Ay8E3lyPeJ30CYG/KKW/KhrZl/L4cwxRdYafMxv tj2PqdEsU/b8o1GMkQfqrJukrETSYXnmrnuCsBad+3w1kMvjRImog9oSPSGfNRoHlnqA c9Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gBO5fykvGQ+RmuON1CwFXQzWBEFVVNtnRsGW7Oa/xDc=; b=YjpJlFmWPcsImgKfD/fgi+HqhGzxQIYVcCSt1joihxwOL6c1uiQ6Foe+Psvg0+aLYm vrxl0rAEsXUgThFuROW69IFul9F3BaUSa0lh2LjCEQATmsb/XFW42tad54tXCmJtwtss F4UZJm3Y1RuC+18cFQ/LWNAfq+G350gWy/jhOaXPfIBwpdShxeu4PeqIo9DLXVBOE19d JOTFtGEFbexDN799nQylHa6GA+g6UYY4EfmQ5ia+NwlzBfSEKZxlB+Trad42fDam3sAu IqO/oR0aiEDxe9Ylp8YMNDNQBidNiSFwWnI63Mde6hfqQeGjeFOzSRgU+s0oyrrQzZvd pbCQ== X-Gm-Message-State: AOAM531KirjLqXmGbwl16QCoKLHneyrT7PUaOHmBbF4XHBo9CaaaBwZp /0kTv6LYnKwqV3fnsidb0i91lNm3s6g= X-Google-Smtp-Source: ABdhPJwbwpmiu6JesMr8h8qq0UMkIB6mxx4UDN08/AHxAB7QRIqdAF5ovEgSTdrMpkJYFwJJbM9H5w== X-Received: by 2002:a17:90a:8002:: with SMTP id b2mr333077pjn.47.1602057388838; Wed, 07 Oct 2020 00:56:28 -0700 (PDT) Received: from archbookpro.hsd1.ca.comcast.net (c-67-188-114-10.hsd1.ca.comcast.net. [67.188.114.10]) by smtp.gmail.com with ESMTPSA id n9sm1909950pgi.2.2020.10.07.00.56.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Oct 2020 00:56:28 -0700 (PDT) From: Denton Liu To: Git Mailing List Subject: [PATCH v2 3/4] add-patch: add NEEDSWORK about comparing commits Date: Wed, 7 Oct 2020 00:56:17 -0700 Message-Id: <44ee78450e1cfe26b47cc4343c5d445df2b96d7b.1602057332.git.liu.denton@gmail.com> X-Mailer: git-send-email 2.28.0.942.g77c4c6094c In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The two versions of add-patch has special-casing for the literal revision "HEAD". However, we want to handle other ways of saying "HEAD" in the same way.[0] Add a NEEDSWORK to the add-patch code that does this so that it can be addressed later. [0]: https://lore.kernel.org/git/xmqqsgat7ttf.fsf@gitster.c.googlers.com/ Signed-off-by: Denton Liu --- add-patch.c | 8 ++++++++ git-add--interactive.perl | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/add-patch.c b/add-patch.c index bd94bd3a7c..be4cf6e9e5 100644 --- a/add-patch.c +++ b/add-patch.c @@ -1695,6 +1695,14 @@ int run_add_p(struct repository *r, enum add_p_mode mode, if (mode == ADD_P_STASH) s.mode = &patch_mode_stash; else if (mode == ADD_P_RESET) { + /* + * NEEDSWORK: Instead of comparing to the literal "HEAD", + * compare the commit objects instead so that other ways of + * saying the same thing (such as "@") are also handled + * appropriately. + * + * This applies to the cases below too. + */ if (!revision || !strcmp(revision, "HEAD")) s.mode = &patch_mode_reset_head; else diff --git a/git-add--interactive.perl b/git-add--interactive.perl index 8a72018712..e713fe3d02 100755 --- a/git-add--interactive.perl +++ b/git-add--interactive.perl @@ -1830,6 +1830,13 @@ sub process_args { $arg = shift @ARGV or die __("missing --"); if ($arg ne '--') { $patch_mode_revision = $arg; + + # NEEDSWORK: Instead of comparing to the literal "HEAD", + # compare the commit objects instead so that other ways of + # saying the same thing (such as "@") are also handled + # appropriately. + # + # This applies to the cases below too. $patch_mode = ($arg eq 'HEAD' ? 'reset_head' : 'reset_nothead'); $arg = shift @ARGV or die __("missing --"); From patchwork Wed Oct 7 07:56:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11819923 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 C5B0E618 for ; Wed, 7 Oct 2020 07:56:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9B5E62083B for ; Wed, 7 Oct 2020 07:56:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="q7mjAShi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727840AbgJGH4f (ORCPT ); Wed, 7 Oct 2020 03:56:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727830AbgJGH4a (ORCPT ); Wed, 7 Oct 2020 03:56:30 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B1D4C0613D2 for ; Wed, 7 Oct 2020 00:56:30 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id kk9so650890pjb.2 for ; Wed, 07 Oct 2020 00:56:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=A8qILUB9OEEbGui0R20rtjYicU327BY8O4waGk+BN4E=; b=q7mjAShizXQYK63PkgWVDaK+28h1nY06Udyxla4nulFeTIuXKK92wpDpt+rWkjb/gI gVBUN3NSjBhaGBY109ostXJne4AertJSSGy+PSotbUYGzxMKhk/Q3B9ZdHFMUqbSCfqX oMonpKoHmEMWPUCWtKC7sMx1DvGnFUQ4k9IzENtnOEbkbAz/S2TeaofBBbLszSJ7n8dA lwcA193lDQHjFJXf+71Sf7VmY/8d6w4BCIk8R1ixaIs9vBu0swelPon8JsBaeLEAl7Dx xzE+CixBTdXKEvrChSxOV3GOQIiJd+AV6yBms9XFXjQIncBaDKWAh0LPyswqHWJCvFgu 57hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=A8qILUB9OEEbGui0R20rtjYicU327BY8O4waGk+BN4E=; b=grQ5hWUD9Pl/LwCzGL/I2HwVzK9Xm/Qfwmf0+Sih5oFVV1RP7nM/7VtdQR/qsuQn+i /ZWFCZPv2w/9mbOhaMX8JVI7XUfSOeZGk0M+sro78p8Y+0q7+3dFk1IKTX6eKmpuUs8Q Nfs4M5H+vH/kUTYEIyycm0TgqdSyVcPcY5UJbZzYwI5pCXVIJtjZ4fvBGJzdWsQVBmFG Ul0LOfrQtJbSjIEEtW0tzCSLxdUIeVf5Wo5/e/IEIRv2WJzknmq2FW4d1crHIvfwBREr iBlM/xkbUS7bx/i5L4UfchUFWPDj9U5ZXr7gPuUnVwR4v4pWYH3ZtQiB5rf/wpSjtorc r9Sg== X-Gm-Message-State: AOAM5330eT5n5K/3XrIncPnkb9FSce2dlpcbsKkw7v7ZHxss5XhqYxuC xQNMzJGoNrF/sXGKGt9t9JDZILE3RCQ= X-Google-Smtp-Source: ABdhPJwtRxa0GeyoxXoKF7dMS7LEkKmy+2Jv15sGzV07vnvRAgsm0vX5h7GKNtaTCOqClLdq5wzNPQ== X-Received: by 2002:a17:90b:710:: with SMTP id s16mr1932114pjz.138.1602057389858; Wed, 07 Oct 2020 00:56:29 -0700 (PDT) Received: from archbookpro.hsd1.ca.comcast.net (c-67-188-114-10.hsd1.ca.comcast.net. [67.188.114.10]) by smtp.gmail.com with ESMTPSA id n9sm1909950pgi.2.2020.10.07.00.56.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Oct 2020 00:56:29 -0700 (PDT) From: Denton Liu To: Git Mailing List Subject: [PATCH v2 4/4] t2016: add a NEEDSWORK about the PERL prerequisite Date: Wed, 7 Oct 2020 00:56:18 -0700 Message-Id: X-Mailer: git-send-email 2.28.0.942.g77c4c6094c In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Since the builtin add-p is used when $GIT_TEST_ADD_I_USE_BUILTIN is given, we should replace the PERL prerequisite with an ADD_I prerequisite which first checks if $GIT_TEST_ADD_I_USE_BUILTIN is defined before checking PERL.[0] Mark this in a NEEDSWORK so that it can be addressed at a later time. [0]: https://lore.kernel.org/git/xmqqsgat7ttf.fsf@gitster.c.googlers.com/ Signed-off-by: Denton Liu --- t/t2016-checkout-patch.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/t/t2016-checkout-patch.sh b/t/t2016-checkout-patch.sh index 999620e507..d91a329eb3 100755 --- a/t/t2016-checkout-patch.sh +++ b/t/t2016-checkout-patch.sh @@ -18,6 +18,10 @@ test_expect_success PERL 'setup' ' # note: bar sorts before dir/foo, so the first 'n' is always to skip 'bar' +# NEEDSWORK: Since the builtin add-p is used when $GIT_TEST_ADD_I_USE_BUILTIN +# is given, we should replace the PERL prerequisite with an ADD_I prerequisite +# which first checks if $GIT_TEST_ADD_I_USE_BUILTIN is defined before checking +# PERL. test_expect_success PERL 'saying "n" does nothing' ' set_and_save_state dir/foo work head && test_write_lines n n | git checkout -p &&