From patchwork Mon Dec 16 15:48:06 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: 11294463 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 00C41138C for ; Mon, 16 Dec 2019 15:48:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BECCC2072B for ; Mon, 16 Dec 2019 15:48:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rxSc7FAx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728565AbfLPPsZ (ORCPT ); Mon, 16 Dec 2019 10:48:25 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:55983 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728552AbfLPPsZ (ORCPT ); Mon, 16 Dec 2019 10:48:25 -0500 Received: by mail-wm1-f68.google.com with SMTP id q9so7256216wmj.5 for ; Mon, 16 Dec 2019 07:48:21 -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=00N20ttLzB6oGXQ9ZIsjQw442RSBaWVfa+sWQeOYQz4=; b=rxSc7FAx+jvtcS1G05sq1cl7MEEk417FLgoUfWD5RAvJsCT8XLp6M0PGpOlau9Thtx G3AOHp+BtIS/Ekgzp/kS8TrzgvvgJt/TDBuA0naFvB8V2CI7WkaYD06VYKJHr0740FGc X4dHQs6NSikFf5BZoVkayoyYVcNBM3dnYBfmnYcYNb8ji55ThoXjDhzuBrpSEZh+AAnk YPFFf7lB9NLEixDSIC4w+kUNym6cybklPautyh7EYG1AR6z7iuOtaHFT6ndZUV7grVp0 rKqwEludeVTXy4Q18F/C+T/COHY1F0Tq67XIoai3YiCQpvmUlm+B/NmHhgzT1OiQDMY1 62Yw== 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=00N20ttLzB6oGXQ9ZIsjQw442RSBaWVfa+sWQeOYQz4=; b=Mv5FI2EoqHw8Js8JMFwR8fa3bbqsP1tf5cNhDQbEAdHV63bOgod/C+Zp/+pk3yAlOI HOiCbpBkVjPVHqj9u3zNWNnC6FYcVxvZZOpI+xGOJi390KMS8dMee1cbhdqeRSAIOcGK j4aAth2KnyLktGCOKstagBuFnlC5yGvj8I1z9NFQG7MMEy/qsEXYiTQYNjWPNb18KD6F 1AbyiHWQO6QNgAT6DHJ6bk/JRZR0oapicUX2PFaZOBgACyJo/fObjjU38CkwZRFf1xFP S3vXIYB3/cJp/9zvMADW5kJd+aK7sZFxEVXTaZjQhoBYHe0eXxuiTeQNiSV0klDyW7ea sMwQ== X-Gm-Message-State: APjAAAUtXFId1aK8py19PpvxGurC4nFYJtIqLqxCidEtD8/GzE6VSGWT I1odeXsmqQFYOtDuak5I5TVsdxqn X-Google-Smtp-Source: APXvYqzGb3wE3A6++6K6kfcJo5m6Bq44uMMuk1WM0rfNn9eS5wXeTRqvM25HYOYhnyAUa/mubV1lBQ== X-Received: by 2002:a7b:c5cd:: with SMTP id n13mr26269217wmk.172.1576511300544; Mon, 16 Dec 2019 07:48:20 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id g2sm21889081wrw.76.2019.12.16.07.48.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Dec 2019 07:48:20 -0800 (PST) Message-Id: In-Reply-To: References: From: "Alexandr Miloslavskiy via GitGitGadget" Date: Mon, 16 Dec 2019 15:48:06 +0000 Subject: [PATCH v2 18/18] checkout, restore: support the --pathspec-from-file option 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 Decisions taken for simplicity: 1) For now, `--pathspec-from-file` is declared incompatible with `--patch`, even when is not `stdin`. Such use case it not really expected. 2) It is not allowed to pass pathspec in both args and file. `you must specify path(s) to restore` block was moved down to be able to test for `pathspec.nr` instead, because testing for `argc` is no longer correct. `git switch` does not support the new options because it doesn't expect `` arguments. Signed-off-by: Alexandr Miloslavskiy --- Documentation/git-checkout.txt | 15 +++++ Documentation/git-restore.txt | 14 +++++ builtin/checkout.c | 33 +++++++++-- t/t2026-checkout-pathspec-file.sh | 90 ++++++++++++++++++++++++++++++ t/t2072-restore-pathspec-file.sh | 91 +++++++++++++++++++++++++++++++ t/t9902-completion.sh | 2 + 6 files changed, 240 insertions(+), 5 deletions(-) create mode 100755 t/t2026-checkout-pathspec-file.sh create mode 100755 t/t2072-restore-pathspec-file.sh diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index 93124f3ad9..ffe3c1bff2 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -13,6 +13,7 @@ SYNOPSIS 'git checkout' [-q] [-f] [-m] [--detach] 'git checkout' [-q] [-f] [-m] [[-b|-B|--orphan] ] [] 'git checkout' [-f|--ours|--theirs|-m|--conflict=