From patchwork Thu Dec 12 14:36:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver via GitGitGadget X-Patchwork-Id: 11288485 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 12A796C1 for ; Thu, 12 Dec 2019 14:36:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CEFE3214AF for ; Thu, 12 Dec 2019 14:36:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Oj/i/ZSF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729754AbfLLOgc (ORCPT ); Thu, 12 Dec 2019 09:36:32 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:34834 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729691AbfLLOga (ORCPT ); Thu, 12 Dec 2019 09:36:30 -0500 Received: by mail-wr1-f66.google.com with SMTP id g17so3002805wro.2 for ; Thu, 12 Dec 2019 06:36:28 -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=BkeKWvqRObbdwemvzzb9R9qWif8vIwHklw2P3Fa4skE=; b=Oj/i/ZSFBfH4dPYLHekBySerBUCXNZcNfRhS4Bp7qBLFrufcL8ih44H7JadboCHeoE /fqK7NuwJEVOR/eOS7Vp+zwOAy9I/7VxCZkvxbFbo+yC6pPjDfzwNPWxh5qMsjXKnYG6 CcO/jJDWQyLPDfuFrL/P2D+ghQvoX7/8wpZxZePyeYe9y/QkXRdHeMeFoJmVCWcQDMia Dyj5cnAr93MW7pfch+qpHyGGLLRZF21chbTlJq0CVVLHFwdEdakCZBI4lDL3XKCzlzAx /+hmLkpMrBU5oKPrSJOTXPjB0Lw406N0Mxh2h9QNzj4RB5XCuj6VqHSROdeiw96zLSEm R2wA== 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=BkeKWvqRObbdwemvzzb9R9qWif8vIwHklw2P3Fa4skE=; b=m78Ccwm7brY98rNyLhhuUFIr+MR3dWaBl2bBjNB4w2dXJ2eCDayl5p9Q2wHAz3z5uf sT3hDcosQMUBtWCmLyWjZhH/1d4noT7wzmYFlOj00/0Bo6skXWN+0yiNaC0UjIjSPbJY R38GCv+Wtn4/auChlF1/7cg+vnocFf1K3KL4Qa90rrwtKsdmHjzXPZnBrjQ89ESoQV8x d6skn7G+5OT95T7a1KKu4JkaZ4ce00eWA/RMpacE7sJTM+vLoOfdVcvVKAdnvHcIsZwm 8LZhq9HA+zMdRD10V/5kVoQuXuN+f1cUDJDIPhVJkuSzBcD9j2wPikMqRvfFPNQOKwjD kj4A== X-Gm-Message-State: APjAAAWfXSJAd3hPSewX5lPqUwt+Pcos2+qxDdDvFi1bi2GBkXklU9QC /gnRql170t7iBQ0CbziV5uK8oPeX X-Google-Smtp-Source: APXvYqzSH54phF80LQgj7wlNOMfUw+0ZIqjPwZMhFCY/xFUadKpx/qP7j+TGgH8p3sHbuQMa/gDxfg== X-Received: by 2002:adf:cd92:: with SMTP id q18mr6585646wrj.261.1576161387232; Thu, 12 Dec 2019 06:36:27 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id v3sm6216901wml.47.2019.12.12.06.36.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 06:36:26 -0800 (PST) Message-Id: In-Reply-To: References: From: "Alexandr Miloslavskiy via GitGitGadget" Date: Thu, 12 Dec 2019 14:36:10 +0000 Subject: [PATCH 01/16] t7107, t7526: directly test parse_pathspec_file() 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 In my previous patches, `parse_pathspec_file()` was tested indirectly by invoking `git reset` and `git commit` with properly crafted inputs. This has some disadvantages: 1) A number of tests are copy&pasted for every command where `--pathspec-from-file` is supported. With just two commands, it wasn't too bad, but I'm going to extend support to many more commands, which would make a handful of low-value tests. 2) Tests are located in suboptimal test packages 3) Tests are indirect Fix this by testing `parse_pathspec_file()` directly via a new test helper. While working on it, I also noticed that quotes testing via `"\"file\\101.t\""` was somewhat incorrect: I escaped `\` one time while I had to escape it two times! Tests still worked due to `"` which prevented pathspec from matching files. Fix this by properly escaping one more time. Signed-off-by: Alexandr Miloslavskiy --- Makefile | 1 + t/helper/test-parse-pathspec-file.c | 34 +++++++++ t/helper/test-tool.c | 1 + t/helper/test-tool.h | 1 + t/t0067-parse_pathspec_file.sh | 89 +++++++++++++++++++++++ t/t7107-reset-pathspec-file.sh | 105 ++-------------------------- t/t7526-commit-pathspec-file.sh | 80 +-------------------- 7 files changed, 134 insertions(+), 177 deletions(-) create mode 100644 t/helper/test-parse-pathspec-file.c create mode 100755 t/t0067-parse_pathspec_file.sh diff --git a/Makefile b/Makefile index b7d7374dac..fd7bcaac9c 100644 --- a/Makefile +++ b/Makefile @@ -721,6 +721,7 @@ TEST_BUILTINS_OBJS += test-mktemp.o TEST_BUILTINS_OBJS += test-oidmap.o TEST_BUILTINS_OBJS += test-online-cpus.o TEST_BUILTINS_OBJS += test-parse-options.o +TEST_BUILTINS_OBJS += test-parse-pathspec-file.o TEST_BUILTINS_OBJS += test-path-utils.o TEST_BUILTINS_OBJS += test-pkt-line.o TEST_BUILTINS_OBJS += test-prio-queue.o diff --git a/t/helper/test-parse-pathspec-file.c b/t/helper/test-parse-pathspec-file.c new file mode 100644 index 0000000000..e7f525feb9 --- /dev/null +++ b/t/helper/test-parse-pathspec-file.c @@ -0,0 +1,34 @@ +#include "test-tool.h" +#include "parse-options.h" +#include "pathspec.h" +#include "gettext.h" + +int cmd__parse_pathspec_file(int argc, const char **argv) +{ + struct pathspec pathspec; + const char *pathspec_from_file = 0; + int pathspec_file_nul = 0, i; + + static const char *const usage[] = { + "test-tool parse-pathspec-file --pathspec-from-file [--pathspec-file-nul]", + NULL + }; + + struct option options[] = { + OPT_PATHSPEC_FROM_FILE(&pathspec_from_file), + OPT_PATHSPEC_FILE_NUL(&pathspec_file_nul), + OPT_END() + }; + + parse_options(argc, argv, 0, options, usage, 0); + + parse_pathspec_file(&pathspec, 0, 0, 0, pathspec_from_file, + pathspec_file_nul); + + for (i = 0; i < pathspec.nr; i++) { + printf("%s\n", pathspec.items[i].original); + } + + clear_pathspec(&pathspec); + return 0; +} diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c index f20989d449..c9a232d238 100644 --- a/t/helper/test-tool.c +++ b/t/helper/test-tool.c @@ -39,6 +39,7 @@ static struct test_cmd cmds[] = { { "oidmap", cmd__oidmap }, { "online-cpus", cmd__online_cpus }, { "parse-options", cmd__parse_options }, + { "parse-pathspec-file", cmd__parse_pathspec_file }, { "path-utils", cmd__path_utils }, { "pkt-line", cmd__pkt_line }, { "prio-queue", cmd__prio_queue }, diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h index 8ed2af71d1..c8549fd87f 100644 --- a/t/helper/test-tool.h +++ b/t/helper/test-tool.h @@ -29,6 +29,7 @@ int cmd__mktemp(int argc, const char **argv); int cmd__oidmap(int argc, const char **argv); int cmd__online_cpus(int argc, const char **argv); int cmd__parse_options(int argc, const char **argv); +int cmd__parse_pathspec_file(int argc, const char** argv); int cmd__path_utils(int argc, const char **argv); int cmd__pkt_line(int argc, const char **argv); int cmd__prio_queue(int argc, const char **argv); diff --git a/t/t0067-parse_pathspec_file.sh b/t/t0067-parse_pathspec_file.sh new file mode 100755 index 0000000000..df7b319713 --- /dev/null +++ b/t/t0067-parse_pathspec_file.sh @@ -0,0 +1,89 @@ +#!/bin/sh + +test_description='Test parse_pathspec_file()' + +. ./test-lib.sh + +test_expect_success 'one item from stdin' ' + echo fileA.t | test-tool parse-pathspec-file --pathspec-from-file=- >actual && + + cat >expect <<-\EOF && + fileA.t + EOF + test_cmp expect actual +' + +test_expect_success 'one item from file' ' + echo fileA.t >list && + test-tool parse-pathspec-file --pathspec-from-file=list >actual && + + cat >expect <<-\EOF && + fileA.t + EOF + test_cmp expect actual +' + +test_expect_success 'NUL delimiters' ' + printf "fileA.t\0fileB.t\0" | test-tool parse-pathspec-file --pathspec-from-file=- --pathspec-file-nul >actual && + + cat >expect <<-\EOF && + fileA.t + fileB.t + EOF + test_cmp expect actual +' + +test_expect_success 'LF delimiters' ' + printf "fileA.t\nfileB.t\n" | test-tool parse-pathspec-file --pathspec-from-file=- >actual && + + cat >expect <<-\EOF && + fileA.t + fileB.t + EOF + test_cmp expect actual +' + +test_expect_success 'no trailing delimiter' ' + printf "fileA.t\nfileB.t" | test-tool parse-pathspec-file --pathspec-from-file=- >actual && + + cat >expect <<-\EOF && + fileA.t + fileB.t + EOF + test_cmp expect actual +' + +test_expect_success 'CRLF delimiters' ' + printf "fileA.t\r\nfileB.t\r\n" | test-tool parse-pathspec-file --pathspec-from-file=- >actual && + + cat >expect <<-\EOF && + fileA.t + fileB.t + EOF + test_cmp expect actual +' + +test_expect_success 'quotes' ' + # shell takes \\\\101 and spits \\101 + # printf takes \\101 and spits \101 + # git takes \101 and spits A + printf "\"file\\\\101.t\"" | test-tool parse-pathspec-file --pathspec-from-file=- >actual && + + cat >expect <<-\EOF && + fileA.t + EOF + test_cmp expect actual +' + +test_expect_success '--pathspec-file-nul takes quotes literally' ' + # shell takes \\\\101 and spits \\101 + # printf takes \\101 and spits \101 + printf "\"file\\\\101.t\"" | test-tool parse-pathspec-file --pathspec-from-file=- --pathspec-file-nul >actual && + + cat >expect <<-\EOF && + "file\101.t" + EOF + test_cmp expect actual +' + +test_done diff --git a/t/t7107-reset-pathspec-file.sh b/t/t7107-reset-pathspec-file.sh index 6b1a731fff..90dba621d6 100755 --- a/t/t7107-reset-pathspec-file.sh +++ b/t/t7107-reset-pathspec-file.sh @@ -25,7 +25,7 @@ verify_expect () { test_cmp expect actual } -test_expect_success '--pathspec-from-file from stdin' ' +test_expect_success 'simplest' ' restore_checkpoint && git rm fileA.t && @@ -37,97 +37,21 @@ test_expect_success '--pathspec-from-file from stdin' ' verify_expect ' -test_expect_success '--pathspec-from-file from file' ' - restore_checkpoint && - - git rm fileA.t && - echo fileA.t >list && - git reset --pathspec-from-file=list && - - cat >expect <<-\EOF && - D fileA.t - EOF - verify_expect -' - -test_expect_success 'NUL delimiters' ' - restore_checkpoint && - - git rm fileA.t fileB.t && - printf "fileA.t\0fileB.t\0" | git reset --pathspec-from-file=- --pathspec-file-nul && - - cat >expect <<-\EOF && - D fileA.t - D fileB.t - EOF - verify_expect -' - -test_expect_success 'LF delimiters' ' - restore_checkpoint && - - git rm fileA.t fileB.t && - printf "fileA.t\nfileB.t\n" | git reset --pathspec-from-file=- && - - cat >expect <<-\EOF && - D fileA.t - D fileB.t - EOF - verify_expect -' - -test_expect_success 'no trailing delimiter' ' - restore_checkpoint && - - git rm fileA.t fileB.t && - printf "fileA.t\nfileB.t" | git reset --pathspec-from-file=- && - - cat >expect <<-\EOF && - D fileA.t - D fileB.t - EOF - verify_expect -' - -test_expect_success 'CRLF delimiters' ' +test_expect_success 'only touches what was listed' ' restore_checkpoint && - git rm fileA.t fileB.t && - printf "fileA.t\r\nfileB.t\r\n" | git reset --pathspec-from-file=- && + git rm fileA.t fileB.t fileC.t fileD.t && + printf "fileB.t\nfileC.t\n" | git reset --pathspec-from-file=- && cat >expect <<-\EOF && - D fileA.t + D fileA.t D fileB.t + D fileC.t + D fileD.t EOF verify_expect ' -test_expect_success 'quotes' ' - restore_checkpoint && - - git rm fileA.t && - printf "\"file\\101.t\"" | git reset --pathspec-from-file=- && - - cat >expect <<-\EOF && - D fileA.t - EOF - verify_expect -' - -test_expect_success 'quotes not compatible with --pathspec-file-nul' ' - restore_checkpoint && - - git rm fileA.t && - printf "\"file\\101.t\"" >list && - # Note: "git reset" has not yet learned to fail on wrong pathspecs - git reset --pathspec-from-file=list --pathspec-file-nul && - - cat >expect <<-\EOF && - D fileA.t - EOF - test_must_fail verify_expect -' - test_expect_success '--pathspec-from-file is not compatible with --soft or --hard' ' restore_checkpoint && @@ -137,19 +61,4 @@ test_expect_success '--pathspec-from-file is not compatible with --soft or --har test_must_fail git reset --hard --pathspec-from-file=list ' -test_expect_success 'only touches what was listed' ' - restore_checkpoint && - - git rm fileA.t fileB.t fileC.t fileD.t && - printf "fileB.t\nfileC.t\n" | git reset --pathspec-from-file=- && - - cat >expect <<-\EOF && - D fileA.t - D fileB.t - D fileC.t - D fileD.t - EOF - verify_expect -' - test_done diff --git a/t/t7526-commit-pathspec-file.sh b/t/t7526-commit-pathspec-file.sh index a06b683534..d8fa362ace 100755 --- a/t/t7526-commit-pathspec-file.sh +++ b/t/t7526-commit-pathspec-file.sh @@ -26,7 +26,7 @@ verify_expect () { test_cmp expect actual } -test_expect_success '--pathspec-from-file from stdin' ' +test_expect_success 'simplest' ' restore_checkpoint && echo fileA.t | git commit --pathspec-from-file=- -m "Commit" && @@ -37,84 +37,6 @@ test_expect_success '--pathspec-from-file from stdin' ' verify_expect ' -test_expect_success '--pathspec-from-file from file' ' - restore_checkpoint && - - echo fileA.t >list && - git commit --pathspec-from-file=list -m "Commit" && - - cat >expect <<-\EOF && - A fileA.t - EOF - verify_expect -' - -test_expect_success 'NUL delimiters' ' - restore_checkpoint && - - printf "fileA.t\0fileB.t\0" | git commit --pathspec-from-file=- --pathspec-file-nul -m "Commit" && - - cat >expect <<-\EOF && - A fileA.t - A fileB.t - EOF - verify_expect -' - -test_expect_success 'LF delimiters' ' - restore_checkpoint && - - printf "fileA.t\nfileB.t\n" | git commit --pathspec-from-file=- -m "Commit" && - - cat >expect <<-\EOF && - A fileA.t - A fileB.t - EOF - verify_expect -' - -test_expect_success 'no trailing delimiter' ' - restore_checkpoint && - - printf "fileA.t\nfileB.t" | git commit --pathspec-from-file=- -m "Commit" && - - cat >expect <<-\EOF && - A fileA.t - A fileB.t - EOF - verify_expect -' - -test_expect_success 'CRLF delimiters' ' - restore_checkpoint && - - printf "fileA.t\r\nfileB.t\r\n" | git commit --pathspec-from-file=- -m "Commit" && - - cat >expect <<-\EOF && - A fileA.t - A fileB.t - EOF - verify_expect -' - -test_expect_success 'quotes' ' - restore_checkpoint && - - printf "\"file\\101.t\"" | git commit --pathspec-from-file=- -m "Commit" && - - cat >expect <<-\EOF && - A fileA.t - EOF - verify_expect expect -' - -test_expect_success 'quotes not compatible with --pathspec-file-nul' ' - restore_checkpoint && - - printf "\"file\\101.t\"" >list && - test_must_fail git commit --pathspec-from-file=list --pathspec-file-nul -m "Commit" -' - test_expect_success 'only touches what was listed' ' restore_checkpoint && From patchwork Thu Dec 12 14:36:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver via GitGitGadget X-Patchwork-Id: 11288483 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 78777138D for ; Thu, 12 Dec 2019 14:36:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5766F227BF for ; Thu, 12 Dec 2019 14:36:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OldeYnjb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729745AbfLLOga (ORCPT ); Thu, 12 Dec 2019 09:36:30 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:34201 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729698AbfLLOga (ORCPT ); Thu, 12 Dec 2019 09:36:30 -0500 Received: by mail-wr1-f68.google.com with SMTP id t2so3014496wrr.1 for ; Thu, 12 Dec 2019 06:36:28 -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=MybhsUPZ79z1yOcG4p/4lYvkTj+f6wafOZ8uoXydn3A=; b=OldeYnjbFi2DrVTnCibsaYDpfbNCnDpBHhF5n+EyE2rJ1hxQ3do/ZLHJDvR3Za5+EW nfHCnEMWg/zdlNBtQnInKZTsodE7T/Boo8qwADue8UX43/qygeUAsHnrl1o1uw/fkf0i MKYDwOJcMvodCzhxfbPq77c9+Gx3P0dc7gr9fU6+EJJCsx8Cs+7WTveVap7sZ4BvA48d fIYQM4hUec5VvfuNtWBB20gRl1lq5XmICevsrVwkwG4Kwz6/2gCUcwVeMA67XMYGAfk4 +s34uAwMx8oJzqwkCyG4NOIMw6hpFVT0kwqKldA1DGLOylhRomlglRAj7B3ByYAN/wNg wycA== 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=MybhsUPZ79z1yOcG4p/4lYvkTj+f6wafOZ8uoXydn3A=; b=pILhh3JwhahuE6JOUnH8uoKCfiKuBhOVwOcaGJz/D3ntEpT5hBnl6LDF47X9OlKA5Z mBxaWB2BDLB153PQfsf0nsH2UErz+Wye4RRozZbbobLyOMfEcuvZxGxU0XBFx56MZcRY SN4d/m34jf0wdEUlOXZdf6xAbBCWmDOQtlKz4njyZlKBmnMpmg2F4OWUkCgtaQCKOnWm kP+KipS/O3ckT5bJ/VxtFBSFebojUTE64lMnrtP5SA+9InFFdGgC5uVLrRNuFUTVh+7V hRqKsMPC2V5sCBA4k6x+nu25Ez6lybVDIARHng82ZFXZZ7f8QMNZ1B3wNbvTmu7STsKR OlPw== X-Gm-Message-State: APjAAAVDwOUBeOSr/VFyXXGePmNGKAkbsxMevK6/OhWlBmknd6vEnFUH quWM6Z1tafmFA557Ky1wx1qWFILN X-Google-Smtp-Source: APXvYqy+4mUPHygEh54fdtRh/1yNdGJhuDLf18UkpW+Ny7tTHCYnIz0OKPsPO5f2fcWJS4xCG5RD0Q== X-Received: by 2002:adf:f1c6:: with SMTP id z6mr7026410wro.279.1576161387837; Thu, 12 Dec 2019 06:36:27 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id 188sm443996wmd.1.2019.12.12.06.36.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 06:36:27 -0800 (PST) Message-Id: In-Reply-To: References: From: "Alexandr Miloslavskiy via GitGitGadget" Date: Thu, 12 Dec 2019 14:36:11 +0000 Subject: [PATCH 02/16] commit: forbid --pathspec-from-file --all 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 I forgot this in my previous patch `--pathspec-from-file` for `git commit` [1]. When both `--pathspec-from-file` and `--all` were specified, `--all` took precedence and `--pathspec-from-file` was ignored. Before `--pathspec-from-file` was implemented, this case was prevented by this check in `parse_and_validate_options()` : die(_("paths '%s ...' with -a does not make sense"), argv[0]); It is unfortunate that these two cases are disconnected. This came as result of how the code was laid out before my patches, where `pathspec` is parsed outside of `parse_and_validate_options()`. This branch is already full of refactoring patches and I did not dare to go for another one. Fix by mirroring `die()` for `--pathspec-from-file` as well. [1] Commit e440fc58 ("commit: support the --pathspec-from-file option" 2019-11-19) Co-authored-by: Phillip Wood Signed-off-by: Alexandr Miloslavskiy Reported-by: would be more appropriate as I didn't write this patch. --- builtin/commit.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/builtin/commit.c b/builtin/commit.c index 2db2ad0de4..893a9f29b2 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -347,6 +347,9 @@ static const char *prepare_index(int argc, const char **argv, const char *prefix if (interactive) die(_("--pathspec-from-file is incompatible with --interactive/--patch")); + if (all) + die(_("--pathspec-from-file with -a does not make sense")); + if (pathspec.nr) die(_("--pathspec-from-file is incompatible with pathspec arguments")); From patchwork Thu Dec 12 14:36:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver via GitGitGadget X-Patchwork-Id: 11288489 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 B9C02112B for ; Thu, 12 Dec 2019 14:36:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 986A122527 for ; Thu, 12 Dec 2019 14:36:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UycH0JmH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729791AbfLLOgf (ORCPT ); Thu, 12 Dec 2019 09:36:35 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:35049 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729709AbfLLOgb (ORCPT ); Thu, 12 Dec 2019 09:36:31 -0500 Received: by mail-wm1-f67.google.com with SMTP id p17so2777871wmb.0 for ; Thu, 12 Dec 2019 06:36:29 -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=/50tsg0WF1RPAKWO+eD4BpY/4M3EHrjNNjTZh3wRJNU=; b=UycH0JmHMm6oQgSwwh6G2acSFsEZ9L5ZdYXucWeB11VayokPqafeZb9E90S0n0ynqU 6q2QL8sujl9PhFVSzwAy5aa0l1HHgyf4BzM35AyNl4hdMtsRX4F0Vdkv7C40ro3e9XSU 3gumdisJqpRVZliXBZfgVZmqfSSZQwFG9gwVkHqWuZY2u/UnkSCJZKwtNZx2/Gbawa9+ 4/qUwkIPAfg9nvvaz0nY4QZVIqMpMD/LYWzetOKFiolBKjOR0Z5FY0CCi6MlFQMe3mhS hJPuA49bCYiM5vKBoSoDnMrUtgipxeX1AbIdHUr4kufR+VbW3oilLTXle+9vKpXswBpV l6Xg== 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=/50tsg0WF1RPAKWO+eD4BpY/4M3EHrjNNjTZh3wRJNU=; b=RJhV1q879kqd0ZoW9T/Kp1IdJJc8v1stpHE6MhFYSX2iXcpHl6I0Se1E8gv+Yt2x4i PxuiR99CWQK8Yozzxhb9G41U4jT/VqsbUCP6P849WA8k9Z+0BNS0fvxm77Pd0TfjTs4P N8680+BVyMd2rnaYn0oL3bRBtHnBxEKj1+de+ty8c1dDdK8Oa5hO8SAWwJJQTe9tkyJ5 yqPYFtOTUl9S1RUgIm+eevlqVxWhJqAcBcXm96w2RiMSnLnii/qz0hIRJndUrEKII7Km MD4NvlJNZvq6Rhrh3e0007sxOst+ISn4lziKlV7sw7gOmIGbYGVK1E4DpDWpQV84lWpu rlRg== X-Gm-Message-State: APjAAAWpQ0+AT03lZk2vCs+VaPFixB0JECoz4iqjL0V8aJ9sl4GQ/9Ko LgsciMY0FGBUF0indQMdUH9jiApk X-Google-Smtp-Source: APXvYqxBN8HIvTveN3H0hZERVYhI/VXOzIbOFGqzydz6Dh8vl6+0kOgfkGVyIHSptq8FGVChBh5EDQ== X-Received: by 2002:a7b:cf01:: with SMTP id l1mr6696895wmg.86.1576161388572; Thu, 12 Dec 2019 06:36:28 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id h2sm6384470wrt.45.2019.12.12.06.36.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 06:36:28 -0800 (PST) Message-Id: <369096494223222ef96e38ca27f0b82c6eb59e92.1576161385.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Alexandr Miloslavskiy via GitGitGadget" Date: Thu, 12 Dec 2019 14:36:12 +0000 Subject: [PATCH 03/16] cmd_add: prepare for next patch 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 Some code blocks were moved down to be able to test for `pathspec.nr` in the next patch. Blocks are moved as is without any changes. This is done as separate patch to reduce the amount of diffs in next patch. Signed-off-by: Alexandr Miloslavskiy --- builtin/add.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/builtin/add.c b/builtin/add.c index d4686d5218..3d1791dd82 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -430,10 +430,6 @@ int cmd_add(int argc, const char **argv, const char *prefix) if (addremove && take_worktree_changes) die(_("-A and -u are mutually incompatible")); - if (!take_worktree_changes && addremove_explicit < 0 && argc) - /* Turn "git add pathspec..." to "git add -A pathspec..." */ - addremove = 1; - if (!show_only && ignore_missing) die(_("Option --ignore-missing can only be used together with --dry-run")); @@ -446,19 +442,6 @@ int cmd_add(int argc, const char **argv, const char *prefix) hold_locked_index(&lock_file, LOCK_DIE_ON_ERROR); - flags = ((verbose ? ADD_CACHE_VERBOSE : 0) | - (show_only ? ADD_CACHE_PRETEND : 0) | - (intent_to_add ? ADD_CACHE_INTENT : 0) | - (ignore_add_errors ? ADD_CACHE_IGNORE_ERRORS : 0) | - (!(addremove || take_worktree_changes) - ? ADD_CACHE_IGNORE_REMOVAL : 0)); - - if (require_pathspec && argc == 0) { - fprintf(stderr, _("Nothing specified, nothing added.\n")); - fprintf(stderr, _("Maybe you wanted to say 'git add .'?\n")); - return 0; - } - /* * Check the "pathspec '%s' did not match any files" block * below before enabling new magic. @@ -468,6 +451,23 @@ int cmd_add(int argc, const char **argv, const char *prefix) PATHSPEC_SYMLINK_LEADING_PATH, prefix, argv); + if (require_pathspec && argc == 0) { + fprintf(stderr, _("Nothing specified, nothing added.\n")); + fprintf(stderr, _("Maybe you wanted to say 'git add .'?\n")); + return 0; + } + + if (!take_worktree_changes && addremove_explicit < 0 && argc) + /* Turn "git add pathspec..." to "git add -A pathspec..." */ + addremove = 1; + + flags = ((verbose ? ADD_CACHE_VERBOSE : 0) | + (show_only ? ADD_CACHE_PRETEND : 0) | + (intent_to_add ? ADD_CACHE_INTENT : 0) | + (ignore_add_errors ? ADD_CACHE_IGNORE_ERRORS : 0) | + (!(addremove || take_worktree_changes) + ? ADD_CACHE_IGNORE_REMOVAL : 0)); + if (read_cache_preload(&pathspec) < 0) die(_("index file corrupt")); From patchwork Thu Dec 12 14:36:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver via GitGitGadget X-Patchwork-Id: 11288511 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 907FC6C1 for ; Thu, 12 Dec 2019 14:36:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6646E2253D for ; Thu, 12 Dec 2019 14:36:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iQ4xsYvO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729784AbfLLOgd (ORCPT ); Thu, 12 Dec 2019 09:36:33 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:34203 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729655AbfLLOgc (ORCPT ); Thu, 12 Dec 2019 09:36:32 -0500 Received: by mail-wr1-f65.google.com with SMTP id t2so3014581wrr.1 for ; Thu, 12 Dec 2019 06:36:30 -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=GsrgKioLwyFbLSgFpkqBy1X71IrR7SM9rusEKBeB90E=; b=iQ4xsYvOCXMETRiJoaBeK8XuVtxEaKg9SiBknkdgjkS8SCeK+P1iOnE98WWiA8rMcK VMh4b+s4tl7zw7W9larrZzpZp7PBAjHtAcyrrfOuGxzeKSqBovWqRm01BbTnfI2+AYZO bQp6EKlFW1+ZPddnoAOiUA5Uhh0SrBiwhIxu9RVkcFL1p+m1rz5ym6A5AEiko1BSxyZm de08kGnzR+ODmoSSGmszdiCu5hrhsRRA5D8Ay6rAq2wnsJnA2zN7KnkIS7W8AuH3jABl uoh6wz6fthL52JAniMvQY0RNCkwJTJP+LEyKX92RGF71XuOkET1GeQ5cwMPUEh5fVjpw W0BQ== 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=GsrgKioLwyFbLSgFpkqBy1X71IrR7SM9rusEKBeB90E=; b=MzCzbZVrqTXM2xlORr82A7xXVS3u9ylblnaeywMQhH6eAgDupUw5cKQSqA+5WJkGH3 05SQzA0NHMuch5AUerFdDGVqFAT4LQKSmsurTy6nPfW1/CcQOa87r2s3MIwctp3t8YuS 3iqi1pWVOO3mLcokwDRBtqbD/cogo6zZM5mV9EE2X2xV79j/ZJa2V0PAtKjBOua4sqQE 1EorrgFUpeDA6Qo/TWTAAzD+xEe4Yto/b+/5kwjLddi/aluw4v+tF1JzI6UQla1zpH5I JHTJ0K2oUU/ROI6g0UwjA7IyHqu2NjxxtWRA4PHc/N5IeOUrqWLCSdUd113UypElemMy hJhA== X-Gm-Message-State: APjAAAWTFELpbFHQBdcZ232a1fiXfYlVTwWkxCt0TLXxajOFZvrw+6mu jTTHm890ZwFi00QPchd33RPrI289 X-Google-Smtp-Source: APXvYqzaDqe/SWJh9qj7LOVsOXVVv7YWAgC3karKvfriJo4zdDsb4ztVSQeFZpV7o1LStRm9mqp7rA== X-Received: by 2002:a05:6000:118e:: with SMTP id g14mr6639672wrx.39.1576161389269; Thu, 12 Dec 2019 06:36:29 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id s1sm6326516wmc.23.2019.12.12.06.36.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 06:36:28 -0800 (PST) Message-Id: <0328fdafbb6c70ec3f3ead84183af94cd060ae0e.1576161385.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Alexandr Miloslavskiy via GitGitGadget" Date: Thu, 12 Dec 2019 14:36:13 +0000 Subject: [PATCH 04/16] add: 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 `--interactive/--patch/--edit`, even when is not `stdin`. Such use case it not really expected. Also, it would require changes to `interactive_add()` and `edit_patch()`. 2) It is not allowed to pass pathspec in both args and file. Signed-off-by: Alexandr Miloslavskiy --- Documentation/git-add.txt | 16 +++++++++++- builtin/add.c | 30 +++++++++++++++++++--- t/t3704-add-pathspec-file.sh | 49 ++++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+), 5 deletions(-) create mode 100755 t/t3704-add-pathspec-file.sh diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt index 8b0e4c7fa8..be5e3ac54b 100644 --- a/Documentation/git-add.txt +++ b/Documentation/git-add.txt @@ -11,7 +11,8 @@ SYNOPSIS 'git add' [--verbose | -v] [--dry-run | -n] [--force | -f] [--interactive | -i] [--patch | -p] [--edit | -e] [--[no-]all | --[no-]ignore-removal | [--update | -u]] [--intent-to-add | -N] [--refresh] [--ignore-errors] [--ignore-missing] [--renormalize] - [--chmod=(+|-)x] [--] [...] + [--chmod=(+|-)x] [--pathspec-from-file= [--pathspec-file-nul]] + [--] [...] DESCRIPTION ----------- @@ -187,6 +188,19 @@ for "git add --no-all ...", i.e. ignored removed files. bit is only changed in the index, the files on disk are left unchanged. +--pathspec-from-file=:: + Pathspec is passed in `` instead of commandline args. If + `` is exactly `-` then standard input is used. Pathspec + elements are separated by LF or CR/LF. Pathspec elements can be + quoted as explained for the configuration variable `core.quotePath` + (see linkgit:git-config[1]). See also `--pathspec-file-nul` and + global `--literal-pathspecs`. + +--pathspec-file-nul:: + Only meaningful with `--pathspec-from-file`. Pathspec elements are + separated with NUL character and all other characters are taken + literally (including newlines and quotes). + \--:: This option can be used to separate command-line options from the list of files, (useful when filenames might be mistaken diff --git a/builtin/add.c b/builtin/add.c index 3d1791dd82..7c21ad492b 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -29,6 +29,8 @@ static const char * const builtin_add_usage[] = { static int patch_interactive, add_interactive, edit_interactive; static int take_worktree_changes; static int add_renormalize; +static int pathspec_file_nul; +static const char *pathspec_from_file; struct update_callback_data { int flags; @@ -320,6 +322,8 @@ static struct option builtin_add_options[] = { N_("override the executable bit of the listed files")), OPT_HIDDEN_BOOL(0, "warn-embedded-repo", &warn_on_embedded_repo, N_("warn when adding an embedded repository")), + OPT_PATHSPEC_FROM_FILE(&pathspec_from_file), + OPT_PATHSPEC_FILE_NUL(&pathspec_file_nul), OPT_END(), }; @@ -414,11 +418,17 @@ int cmd_add(int argc, const char **argv, const char *prefix) builtin_add_usage, PARSE_OPT_KEEP_ARGV0); if (patch_interactive) add_interactive = 1; - if (add_interactive) + if (add_interactive) { + if (pathspec_from_file) + die(_("--pathspec-from-file is incompatible with --interactive/--patch")); exit(interactive_add(argc - 1, argv + 1, prefix, patch_interactive)); + } - if (edit_interactive) + if (edit_interactive) { + if (pathspec_from_file) + die(_("--pathspec-from-file is incompatible with --edit")); return(edit_patch(argc, argv, prefix)); + } argc--; argv++; @@ -451,13 +461,25 @@ int cmd_add(int argc, const char **argv, const char *prefix) PATHSPEC_SYMLINK_LEADING_PATH, prefix, argv); - if (require_pathspec && argc == 0) { + if (pathspec_from_file) { + if (pathspec.nr) + die(_("--pathspec-from-file is incompatible with pathspec arguments")); + + parse_pathspec_file(&pathspec, PATHSPEC_ATTR, + PATHSPEC_PREFER_FULL | + PATHSPEC_SYMLINK_LEADING_PATH, + prefix, pathspec_from_file, pathspec_file_nul); + } else if (pathspec_file_nul) { + die(_("--pathspec-file-nul requires --pathspec-from-file")); + } + + if (require_pathspec && pathspec.nr == 0) { fprintf(stderr, _("Nothing specified, nothing added.\n")); fprintf(stderr, _("Maybe you wanted to say 'git add .'?\n")); return 0; } - if (!take_worktree_changes && addremove_explicit < 0 && argc) + if (!take_worktree_changes && addremove_explicit < 0 && pathspec.nr) /* Turn "git add pathspec..." to "git add -A pathspec..." */ addremove = 1; diff --git a/t/t3704-add-pathspec-file.sh b/t/t3704-add-pathspec-file.sh new file mode 100755 index 0000000000..b7f3fedcb8 --- /dev/null +++ b/t/t3704-add-pathspec-file.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +test_description='add --pathspec-from-file' + +. ./test-lib.sh + +test_tick + +test_expect_success setup ' + test_commit file0 && + echo A >fileA.t && + echo B >fileB.t && + echo C >fileC.t && + echo D >fileD.t +' + +restore_checkpoint () { + git reset +} + +verify_expect () { + git status --porcelain --untracked-files=no -- fileA.t fileB.t fileC.t fileD.t >actual && + test_cmp expect actual +} + +test_expect_success 'simplest' ' + restore_checkpoint && + + echo fileA.t | git add --pathspec-from-file=- && + + cat >expect <<-\EOF && + A fileA.t + EOF + verify_expect +' + +test_expect_success 'only touches what was listed' ' + restore_checkpoint && + + printf "fileB.t\nfileC.t\n" | git add --pathspec-from-file=- && + + cat >expect <<-\EOF && + A fileB.t + A fileC.t + EOF + verify_expect +' + +test_done From patchwork Thu Dec 12 14:36:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver via GitGitGadget X-Patchwork-Id: 11288509 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 35399138D for ; Thu, 12 Dec 2019 14:36:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 142E222527 for ; Thu, 12 Dec 2019 14:36:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BXp+j6Qf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729787AbfLLOge (ORCPT ); Thu, 12 Dec 2019 09:36:34 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:33166 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729698AbfLLOgc (ORCPT ); Thu, 12 Dec 2019 09:36:32 -0500 Received: by mail-wr1-f66.google.com with SMTP id b6so3029733wrq.0 for ; Thu, 12 Dec 2019 06:36:30 -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=aYqtUfxrzTqHVRn2pfoo5R2+4lk0OX725HiLpzyYtMg=; b=BXp+j6QfSAIXMSlBfnFU5I7iig+106KHKZGoQOjxRUxXcNHcr76DrGlhQYeSIszwoA DU4J6s7VwVghaLPg1r3N02g8Z2uRIKGep7+mI8hURwL7gcg2dL9jTPlZ9YJxvouUdb0y n3tPREG9Kc6bVUIWKIvMJ7XaWdyP4iZr610VyLrtI5p4CpLg0rRyHGJ0k+ZaFc1Pcypg K289P8txe4nKghvIOs8vOLDinzS6IdgzKjXv/xxH3b2+WPs+FW42QHcuEuA/xnyUeqqT oijEkLlfu9pkOs4i5epi1AkkH4Ta+XlygpDTbvgQIhZ/L+vkbpynZRIH54wrxj18vv5W W7HA== 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=aYqtUfxrzTqHVRn2pfoo5R2+4lk0OX725HiLpzyYtMg=; b=YGdkK3mU+PPczBZJWW6ZtFG7s/Ii/VHXBg3oNkeRw4ortEMk3Y0w+On1jg8R8ziBHu q42jBJwfe1VHbNfdO5fgrTvWAz2BqmTMmCPoPFBMzYhMQDcrcfpEJalFW27AnUJfPoEJ NUpgi+kTq6UOU/E78sJ8EkGbJVjGdSkAbIxm2rDWZcBpp5dv0HtZjwNooRVkTOSzvtUy r7LciOfJq8JAdVOb7Ioo7e0hElTs6eoIuVUfa0jNs1p5Std9GhareeyLAcubr4TCEdnB RsElexmtxDYgMeGAi02/0MW5fGxOgPgMF7tXMLGX89yqHWwMkgZRlqKUiIfm+HmSapHY m5vQ== X-Gm-Message-State: APjAAAXoJlc7z4+TqkBW2FzB22pWNf6uqRRBcLyt81zCTP/EhJNFZlrL hH+J30B/JIA+JtoCOqjc/CwIMZR1 X-Google-Smtp-Source: APXvYqxCZqwo6cw2x3BXji2I0GhkpXbJ+LlRrjQDdKfdl2qPqOdCT7YeMhsR9kppsRRgHtNj2U1NPA== X-Received: by 2002:a5d:62c8:: with SMTP id o8mr4714350wrv.316.1576161390062; Thu, 12 Dec 2019 06:36:30 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id c17sm6073151wrr.87.2019.12.12.06.36.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 06:36:29 -0800 (PST) Message-Id: <8677db4b9efb220f10a80d377c5d4038df860a48.1576161385.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Alexandr Miloslavskiy via GitGitGadget" Date: Thu, 12 Dec 2019 14:36:14 +0000 Subject: [PATCH 05/16] doc: checkout: remove duplicate synopsis 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 It was added in [1]. I understand that the duplicate change was not intentional and comes from an oversight. Also, in explanation, there was only one section for two synopsis entries. Fix both problems by removing duplicate synopsis. vs is resolved in next patch. [1] Commit b59698ae ("checkout doc: clarify command line args for "checkout paths" mode" 2017-10-11) Signed-off-by: Alexandr Miloslavskiy --- Documentation/git-checkout.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index cf3cac0a2b..2011fdbb1d 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -13,7 +13,6 @@ SYNOPSIS 'git checkout' [-q] [-f] [-m] [--detach] 'git checkout' [-q] [-f] [-m] [[-b|-B|--orphan] ] [] 'git checkout' [-f|--ours|--theirs|-m|--conflict=